Register for your free account! | Forgot your password?

You last visited: Today at 23:03

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



What am I missing?

Discussion on What am I missing? within the CO2 Private Server forum part of the Conquer Online 2 category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
What am I missing?

Code:
case 6001:
                                    {
                                        if (CanUseSpell(spell, attacker.Owner))
                                        {
                                            PrepareSpell(spell, attacker.Owner);
                                            MsgMagicEffect suse = new MsgMagicEffect(true);
                                            suse.Attacker = attacker.UID;
                                            suse.SpellID = spell.ID;
                                            suse.SpellLevel = spell.Level;
                                            suse.X = X;
                                            suse.Y = Y;
                                            if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= spell.Distance)
                                            {
                                                foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (_obj.MapObjType == MapObjectType.Player || _obj.MapObjType == MapObjectType.Monster)
                                                    {
                                                        attacked = _obj as Player;
                                                        if (attacked.MapObjType == MapObjectType.Monster)
                                                            if (attacked.Name == "TeratoDragon")//SnowBanshee
                                                                continue;
                                                        if (attacked.Name == "SnowBanshee")//SnowBanshee
                                                            continue;
                                                        if (attacked.Name == "ThrillingSpook")//SnowBanshee
                                                            continue;
                                                        if (attacked.Name == "SwordMaster")//SnowBanshee
                                                            continue;
                                                        if (attacked.Name == "LavaBeast")//SnowBanshee
                                                            continue;
                                                        if (attacked.Name == "Guard1")//SnowBanshee
                                                            continue;
                                                        if (spell.ID == 6001)
                                                        {
                                                            MsgMagicCoat.Process(attacker.Owner, attacked, spell.ID);
                                                        }
                                                        if (Constants.NoVeneno.Contains(attacked.Name))
                                                            continue;
                                                        if (Kernel.GetDistance(X, Y, attacked.X, attacked.Y) <= spell.Range)
                                                        {
                                                            if (CanAttack(attacker, attacked, spell, attack.InteractType == MsgInteract.Melee))
                                                            {
                                                                uint damage = Calculate.Percent(attacked, spell.PowerPercent);
                                                                int potDifference = attacker.BattlePower - attacked.BattlePower;
                                                                int rate = (int)spell.Percent + potDifference - 20;
                                                                if (Kernel.Rate(rate))
                                                                {
                                                                    attacked.Hitpoints -= damage;
                                                                    attacked.ToxicFogStamp = Time32.Now;
                                                                    attacked.ToxicFogLeft = 20;
                                                                    attacked.ToxicFogPercent = spell.PowerPercent;                                                                    
                                                                    attacked.AddFlag((ulong)MsgUpdate.Flags.Poisoned, attacked.ToxicFogLeft, true);                                                                    
                                                                    suse.AddTarget(attacked.UID, damage, null);                                                                   
                                                                }
                                                                else
                                                                {
                                                                    //attacked.Hitpoints -= damage;
                                                                    suse.AddTarget(attacked.UID, 0, null);
                                                                    suse.Targets[attacked.UID].Hit = false;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                attacker.AttackPacket = null;
                                            }
                                            attacker.Owner.SendScreen(suse, true);
                                        }
                                        break;
                                    }
It damages on impact but doesn't continue to damage like it should, originally it didn't even damage but I managed to figure out why.
denominator is offline  
Old 03/19/2021, 13:09   #2
 
elite*gold: 0
Join Date: Jul 2011
Posts: 96
Received Thanks: 76
First of all, this piece of code is terrible. You are processing 6 strcmp for every valid target. At least replace them with monsterID checks, jesus.

And you have a mistake here

Code:
attacked = _obj as Player;
                                                        if (attacked.MapObjType == MapObjectType.Monster)
                                                            if (attacked.Name == "TeratoDragon")//SnowBanshee
                                                                continue;
                                                        if (attacked.Name == "SnowBanshee")//SnowBanshee
                                                            continue;
                                                        if (attacked.Name == "ThrillingSpook")//SnowBanshee
                                                            continue;
                                                        if (attacked.Name == "SwordMaster")//SnowBanshee
                                                            continue;
                                                        if (attacked.Name == "LavaBeast")//SnowBanshee
                                                            continue;
                                                        if (attacked.Name == "Guard1")//SnowBanshee
                                                            continue;
I think you are checking if "attacked" is a monster to check for names but since you are not using curly brackets, it only check for if monster for TeratoDragon and checks for other's no matter what. So technically, I could create a character named "SwordMaster" and I'd be immune to "ToxicFog"

To be honest, everything about this piece of code is wrong. But the reason why ToxicFog deals initial damage but doesn't deal more damage is because you are just putting this target flag for "Poisoned" but you are most probably missing logic to process that flag.
Latyos is offline  
Thanks
1 User
Old 03/19/2021, 13:26   #3
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
The code was already in the source. Same as pirate skills that weren't working but I managed to get them working. Thank you for replying

I'm assuming this is the logic

Code:
 #region ToxicFog
                if (client.Player.ToxicFogLeft > 0)
                {
                    if (Now >= client.Player.ToxicFogStamp.AddSeconds(2))
                    {
                        float Percent = client.Player.ToxicFogPercent;
                        Percent = Percent / 100 * (client.Player.Detoxication / 100F);
                        //Remove this line if you want it normal
                        Percent = Math.Min(0.1F, client.Player.ToxicFogPercent);
                        client.Player.ToxicFogLeft--;
                        if (client.Player.ToxicFogLeft == 0)
                        {
                            client.Player.RemoveFlag((ulong)MsgUpdate.Flags.Poisoned);
                            return;
                        }
                        client.Player.ToxicFogStamp = Now;
                        if (client.Player.Hitpoints > 1)
                        {
                            uint damage = Game.Attacking.Calculate.Percent(client.Player, Percent);
                            client.Player.Hitpoints -= damage;
                            Network.GamePackets.MsgMagicEffect suse = new Network.GamePackets.MsgMagicEffect(true);
                            suse.Attacker = client.Player.UID;
                            suse.SpellID = 10010;
                            suse.AddTarget(client.Player.UID, damage, null);
                            client.SendScreen(suse, true);
                            if (client != null)
                                client.UpdateQualifier(damage, true);
                        }
                    }
                }
                else
                {
                    if (client.Player.ContainsFlag((ulong)MsgUpdate.Flags.Poisoned))
                        client.Player.RemoveFlag((ulong)MsgUpdate.Flags.Poisoned);
                }
                #endregion
This is in my Thread.cs whilst the original code/post is in Handle.cs

Code:
public enum Flags : ulong
        {
            FlashingName = 0,
            Poisoned = 1,
denominator is offline  
Old 03/19/2021, 13:44   #4
 
elite*gold: 0
Join Date: Jul 2011
Posts: 96
Received Thanks: 76
Quote:
Originally Posted by denominator View Post
The code was already in the source. Same as pirate skills that weren't working but I managed to get them working. Thank you for replying

I'm assuming this is the logic

Code:
 #region ToxicFog
                if (client.Player.ToxicFogLeft > 0)
                {
                    if (Now >= client.Player.ToxicFogStamp.AddSeconds(2))
                    {
                        float Percent = client.Player.ToxicFogPercent;
                        Percent = Percent / 100 * (client.Player.Detoxication / 100F);
                        //Remove this line if you want it normal
                        Percent = Math.Min(0.1F, client.Player.ToxicFogPercent);
                        client.Player.ToxicFogLeft--;
                        if (client.Player.ToxicFogLeft == 0)
                        {
                            client.Player.RemoveFlag((ulong)MsgUpdate.Flags.Poisoned);
                            return;
                        }
                        client.Player.ToxicFogStamp = Now;
                        if (client.Player.Hitpoints > 1)
                        {
                            uint damage = Game.Attacking.Calculate.Percent(client.Player, Percent);
                            client.Player.Hitpoints -= damage;
                            Network.GamePackets.MsgMagicEffect suse = new Network.GamePackets.MsgMagicEffect(true);
                            suse.Attacker = client.Player.UID;
                            suse.SpellID = 10010;
                            suse.AddTarget(client.Player.UID, damage, null);
                            client.SendScreen(suse, true);
                            if (client != null)
                                client.UpdateQualifier(damage, true);
                        }
                    }
                }
                else
                {
                    if (client.Player.ContainsFlag((ulong)MsgUpdate.Flags.Poisoned))
                        client.Player.RemoveFlag((ulong)MsgUpdate.Flags.Poisoned);
                }
                #endregion


If that source is filled with that kind of code, I think you better drop it before you put much work in it. If I could find such an exploit in less than 100 LoC, I don't even want to imagine rest of the source.

Seems like it
Latyos is offline  
Old 03/19/2021, 14:03   #5
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
It's a COServer source, also it's for personal use

Better logic? Regardless it still doesn't work lmao
Code:
if (client.Player.ToxicFogLeft > 0)
                {
                    if (Now >= client.Player.ToxicFogStamp.AddSeconds(2))
                    {
                        float Percent = client.Player.ToxicFogPercent;
                        if (client.Player.Detoxication != 0)
                        {
                            float immu = 1 - client.Player.Detoxication / 100F;
                            Percent = Percent * immu;
                        }
                        client.Player.ToxicFogLeft--;
                        if (client.Player.ToxicFogLeft == 0)
                        {
                            client.Player.RemoveFlag((ulong)(MsgUpdate.Flags.Poisoned));
                            return;
                        }
                        client.Player.ToxicFogStamp = Now;
                        if (client.Player.Hitpoints > 1)
                        {
                            uint damage = Game.Attacking.Calculate.Percent(client.Player, Percent);
                            if (client.Player.ContainsFlag((ulong)(Network.GamePackets.MsgUpdate.Flags.AzureShield)))
                            {

                                if (damage > client.Player.AzureShieldDefence)
                                {
                                    damage -= client.Player.AzureShieldDefence;
                                    Game.Attacking.Calculate.CreateAzureDmg(client.Player.AzureShieldDefence, client.Player, client.Player);
                                    client.Player.RemoveFlag((ulong)(Network.GamePackets.MsgUpdate.Flags.AzureShield));
                                }
                                else
                                {
                                    Game.Attacking.Calculate.CreateAzureDmg((uint)damage, client.Player, client.Player);
                                    client.Player.AzureShieldDefence -= (ushort)damage;
                                    client.Player.AzureShieldPacket();
                                    damage = 1;
                                }
                            }
                            else
                                client.Player.Hitpoints -= damage;

                            Network.GamePackets.MsgMagicEffect suse = new Network.GamePackets.MsgMagicEffect(true);
                            suse.Attacker = client.Player.UID;
                            suse.SpellID = 10010;
                            suse.AddTarget(client.Player.UID, damage, null);
                            client.SendScreen(suse, true);
                            if (client != null)
                                client.UpdateQualifier(damage, true);

                        }
                    }
                }
                else
                {
                    if (client.Player.ContainsFlag((ulong)MsgUpdate.Flags.Poisoned))
                        client.Player.RemoveFlag((ulong)MsgUpdate.Flags.Poisoned);
                }
Doh if only I had tested it pvp instead of just pvm fml, it works I guess I have overworked my brain over the past few days, therefore my question should have been why isn't it attacking monsters
denominator is offline  
Reply


Similar Threads Similar Threads
[INFO]About missing msvcr100.dll / msvcp100.dll and other missing dll files
08/22/2017 - S4 League Hacks, Bots, Cheats & Exploits - 106 Replies
English Maybe if you wanna start a hack from Elitepvpers you will get this Error: or a similar message This dll files are for programs written in C/C++ with Visual Studio To fix this problem you need to download the Microsoft Visual C++ 2010 Redistributable Package (x86) from here: Download Microsoft Visual C++ 2010 Redistributable Package (x86) from Official Microsoft Download Center If you have a 64-Bit System you also need the Microsoft Visual C++ 2010 Redistributable Package...
Missing MAP Missing skill 2M DK TzPhQy BOT v2.x & 1.8 (Exp)
01/19/2010 - Dekaron - 8 Replies
Missing MAP Missing skill 2M DK TzPhQy BOT v2.x & 1.8 (Exp) :rtfm:
Missing dbmon.exe file missing
11/05/2009 - Dekaron Private Server - 2 Replies
Can somone give me a download link or somthing just for dbmon.exe please and thank you



All times are GMT +1. The time now is 23:04.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.