[Help]Scatter skill

02/05/2014 19:32 akosicamar2#1
I had read few threads ago and didn't find same of my problem now.
Scatter skill doesn't work.
Please help me :( I already set up my source on vps so I really need your help guys.

Code:
                                    #region Scatter
                                    case 8001:
                                        {
                                            if (CanUseSpell(spell, attacker.Owner))
                                            {
                                                PrepareSpell(spell, attacker.Owner);

                                                SpellUse suse = new SpellUse(true);
                                                suse.Attacker = attacker.UID;
                                                suse.SpellID = spell.ID;
                                                suse.SpellLevel = spell.Level;
                                                suse.X = X;
                                                suse.Y = Y;
                                                if (attacker.xx == attacker.X && attacker.yy == attacker.Y)
                                                {
                                                    attacker.scatter += 1;
                                                    if (attacker.scatter > 30)
                                                    {
                                                        attacker.Owner.Disconnect();
                                                    }
                                                }
                                                else
                                                {
                                                    attacker.xx = attacker.X;
                                                    attacker.yy = attacker.Y;
                                                    attacker.scatter = 0;
                                                }

                                                Sector sector = new Sector(attacker.X, attacker.Y, X, Y);
                                                sector.Arrange(spell.Sector, spell.Distance);
                                                foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (_obj == null)
                                                        continue;
                                                    if (_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Player)
                                                    {
                                                        attacked = _obj as Entity;

                                                        if (sector.Inside(attacked.X, attacked.Y))
                                                        {
                                                            if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
                                                            {
                                                                attack.Effect1 = Attack.AttackEffects1.None;
                                                                uint damage = Game.Attacking.Calculate.Ranged(attacker, attacked, spell, ref attack);

                                                                ReceiveAttack(attacker, attacked, attack, damage, spell);

                                                                suse.Targets.Add(attacked.UID, damage);
                                                            }
                                                        }
                                                    }
                                                    else if (_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        attackedsob = _obj as SobNpcSpawn;

                                                        if (sector.Inside(attackedsob.X, attackedsob.Y))
                                                        {
                                                            if (CanAttack(attacker, attackedsob, spell))
                                                            {
                                                                attack.Effect1 = Attack.AttackEffects1.None;
                                                                uint damage = Game.Attacking.Calculate.Ranged(attacker, attackedsob, ref attack);
                                                                suse.Effect1 = attack.Effect1;
                                                                if (damage == 0)
                                                                    damage = 1;
                                                                damage = Game.Attacking.Calculate.Percent((int)damage, spell.PowerPercent);

                                                                ReceiveAttack(attacker, attackedsob, attack, damage, spell);

                                                                suse.Targets.Add(attackedsob.UID, damage);
                                                            }
                                                        }
                                                    }
                                                }
                                                attacker.Owner.SendScreen(suse, true);
                                            }
                                            break;
                                        }
                                    #endregion
02/05/2014 20:01 abdoumatrix#2
Arrow Problem

search for

and u will find in his codes
comment this codes like this

02/05/2014 20:35 akosicamar2#3
so you mean I will replace the
Code:
if (CanUseSpell(spell, attacker.Owner))
                                            {
                                                PrepareSpell(spell, attacker.Owner);

                                                SpellUse suse = new SpellUse(true);
                                                suse.Attacker = attacker.UID;
                                                suse.SpellID = spell.ID;
                                                suse.SpellLevel = spell.Level;
                                                suse.X = X;
                                                suse.Y = Y;
to
Code:
/* if (spell.UseArrows > 0 && isArcherSkill(spell.ID))
{
var weapons = client.Weapons;
if (weapons.Item2 != null)
if (!client.Entity.ContainsFlag3(Update.Flags3.Assass in))
if (!PacketHandler.IsArrow(weapons.Item2.ID))
return false;

return true;
}*/
02/05/2014 20:52 abdoumatrix#4
Quote:
Originally Posted by abdoumatrix View Post
Arrow Problem

search for

and u will find in his codes
comment this codes like this


Edited
02/05/2014 21:04 akosicamar2#5
here bro.
Code:
public static bool CanUseSpell(Database.SpellInformation spell, Client.GameState client)
        {
            if (client.WatchingGroup != null)
                return false;
            if (spell == null)
                return false;
            if (client.Entity.Mana < spell.UseMana)
                return false;
            if (client.Entity.Stamina < spell.UseStamina)
                return false;
            if (!client.AlternateEquipment)
            {
                if (spell.UseArrows > 0 && isArcherSkill(spell.ID))
                {
                    if (!client.Equipment.Free((byte)ConquerItem.LeftWeapon))
                    {
                        Interfaces.IConquerItem arrow = client.Equipment.TryGetItem(ConquerItem.LeftWeapon);
                        if (arrow.Durability <= spell.UseArrows)
                        {
                            return false;
                        }
                        return arrow.Durability >= spell.UseArrows;
                    }
                    return false;
                }
            }
            else
            {
                if (spell.UseArrows > 0 && isArcherSkill(spell.ID))
                {
                    if (!client.Equipment.Free((byte)ConquerItem.AltLeftHand))
                    {
                        Interfaces.IConquerItem arrow = client.Equipment.TryGetItem(ConquerItem.AltLeftHand);
                        if (arrow.Durability <= spell.UseArrows)
                        {
                            return false;
                        }
                        return arrow.Durability >= spell.UseArrows;
                    }
                    return false;
                }
            }
            if (spell.NeedXP == 1 && !client.Entity.ContainsFlag(Update.Flags.XPList) && !ServerBase.Constants.AllowSkillsonXp.Contains(spell.ID))
                return false;
            return true;
02/05/2014 21:21 abdoumatrix#6

remove this
02/05/2014 21:49 akosicamar2#7
It works!

Now I know ! :D Thank you bro. <3