Disabling archer pk

09/15/2010 07:15 salem rey#1
Can anyone give me code that archer cant pk any char?

like this: this is just a sample

if (GC.MyChar.Job == 40 && GC.MyChar.Job == 41 && GC.MyChar.Job == 42 && GC.MyChar.Job == 44 GC.MyChar.Job == 45)
{
blah blah blah... :D
return;
}


any can help me?
09/15/2010 07:16 DerTeD#2
??
-please write it again ...i cant understand this
09/15/2010 07:22 Huseby#3
He/She want to disable the feature for archers to PK.
Fixed the name to something a bit more understandable.
09/15/2010 09:23 Korvacs#4
Just put what you have written at the beginning of the attack handler for archers...
09/15/2010 11:46 dowhatuwant#5
in character.cs find:
Code:
public void TakeAttack(Character Attacker, uint Damage, AttackType AT, bool IsSkill)
replace the whole code with:
Code:
public void TakeAttack(Character Attacker, uint Damage, AttackType AT, bool IsSkill)
        {
            if (Attacker.Job >= 40 && Attacker.Job <= 45)
            {
                return;
            }
            if (Alive)
            {
                if (Protection) Damage = 0;
                if (AT == AttackType.Melee && !IsSkill)
                    if (AT == AttackType.Melee || AT == AttackType.Ranged || AT == AttackType.FatalStrike || AT == AttackType.Magic && IsSkill)
                        if (BuffOf(SkillsClass.ExtraEffect.Fly).Eff == SkillsClass.ExtraEffect.Fly)
                            return;
                if (BuffOf(SkillsClass.ExtraEffect.Scapegoat).Eff == SkillsClass.ExtraEffect.Scapegoat && MyMath.ChanceSuccess(30))
                {
                    Buff B = BuffOf(SkillsClass.ExtraEffect.Scapegoat);
                    RemoveBuff(B);
                    uint Dmg = (uint)(PrepareAttack(2, false) * B.Value);
                    Attacker.TakeAttack(this, Dmg, AttackType.Scapegoat, false);
                    return;//Will not be damaged
                }

                if (World.NoPKMaps.Contains(Loc.Map))
                    Damage = 0;
                if (this != Attacker)
                {
                    if (!BlueName && PKPoints < 30 && !World.FreePKMaps.Contains(Loc.Map))
                    {
                        Attacker.BlueName = true;
                        if (Attacker.BlueNameLasts < 15)
                            Attacker.BlueNameLasts = 15;
                    }
                }
                if (AT != AttackType.Magic && Attacker.BuffOf(SkillsClass.ExtraEffect.Superman).Eff == SkillsClass.ExtraEffect.Superman)
                    Damage *= 2;
                if (AT != AttackType.Magic && !IsSkill)
                {
                    ushort _Agi = (ushort)(Attacker.Agi + Attacker.EqStats.ExtraDex);

                    Buff Accuracy = Attacker.BuffOf(SkillsClass.ExtraEffect.Accuracy);
                    if (Accuracy.Eff == SkillsClass.ExtraEffect.Accuracy)
                        _Agi = (ushort)(_Agi * Accuracy.Value);

                    double MissValue = Rnd.Next(_Agi - 25, _Agi + 25);
                    if (MissValue <= EqStats.Dodge)
                        Damage = 0;
                }
                if (AT != AttackType.Magic && Action == 250)
                {
                    if (Stamina > 30)
                        Stamina -= 30;
                    else
                        Stamina = 0;
                }
                Action = 100;
                if (Damage != 0 && !IsSkill)
                {
                    if (AT == AttackType.Melee)
                    {
                        ushort Def = EqStats.defense;
                        Buff Shield = BuffOf(SkillsClass.ExtraEffect.MagicShield);
                        if (Shield.Eff == SkillsClass.ExtraEffect.MagicShield)
                            Def = (ushort)(Def * Shield.Value);

                        if (Def >= Damage)
                            Damage = 1;
                        else
                            Damage -= Def;

                        Damage = (uint)((double)Damage * (100 - EqStats.TotalBless) / 100);

                        Damage += Attacker.EqStats.MeleeDamageIncrease;

                        if (EqStats.MeleeDamageDecrease >= Damage)
                            Damage = 1;
                        else
                            Damage -= EqStats.MeleeDamageDecrease;
                    }
                    else if (AT == AttackType.Ranged)
                    {
                        Damage = (uint)((double)Damage * (((double)(110 - EqStats.Dodge) / 100)));
                        if (EqStats.Dodge >= Damage)
                            Damage = 1;
                        else
                            Damage -= EqStats.Dodge;
                        Damage = Damage * 2 / 3;
                        Damage = (uint)((double)Damage * (100 - EqStats.TotalBless) / 100);

                        Damage += Attacker.EqStats.MeleeDamageIncrease;

                        if (EqStats.MeleeDamageDecrease >= Damage)
                            Damage = 1;
                        else
                            Damage -= EqStats.MeleeDamageDecrease;
                    }
                    else
                    {
                        Damage = (uint)((double)Damage * (((double)(100 - EqStats.MDef1) / 100)));
                        if (EqStats.MDef2 >= Damage)
                            Damage = 1;
                        else
                            Damage -= EqStats.MDef2;
                        Damage = (uint)((double)Damage * (100 - EqStats.TotalBless) / 100);

                        Damage += Attacker.EqStats.MagicDamageIncrease;

                        if (EqStats.MagicDamageIncrease >= Damage)
                            Damage = 1;
                        else
                            Damage -= EqStats.MagicDamageIncrease;
                    }
                }
                if (BuffOf(SkillsClass.ExtraEffect.ShurikenVortex).Eff == SkillsClass.ExtraEffect.ShurikenVortex)
                    Damage = 1;
                if (Damage < CurHP)
                {
                    CurHP -= (ushort)Damage;
                    if (AT != AttackType.Magic && !IsSkill)
                        World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AT).Get);
                }
                else
                {
                    InitAngry(true);
                    Attacker.AtkMem.Attacking = false;
                    Attacker.AtkMem.Target = 0;
                    AtkMem.Attacking = false;
                    AtkMem.Target = 0;

                    if (!World.FreePKMaps.Contains(Loc.Map))
                    {
                        LoseInvItemsAndSilvers();
                        if (PKPoints >= 30)
                            LoseEquips();
                        if (!BlueName)
                        {
                            Attacker.BlueNameLasts += 45;
                            if (Attacker.Enemies.Contains(EntityID))
                                Attacker.PKPoints += 5;
                            else
                                Attacker.PKPoints += 10;
                        }
                        if (!Enemies.Contains(Attacker.EntityID))
                        {
                            Enemies.Add(Attacker.EntityID, new Enemy() { UID = Attacker.EntityID, Name = Attacker.Name });
                            MyClient.AddSend(Packets.FriendEnemyPacket(Attacker.EntityID, Attacker.Name, 19, 1));
                        }
                    }
                    Alive = false;
                    CurHP = 0;

                    if (AT != AttackType.Magic && !IsSkill)
                        World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AT).Get);
                    World.Action(this, Packets.AttackPacket(Attacker.EntityID, EntityID, Loc.X, Loc.Y, Damage, (byte)AttackType.Kill).Get);

                    StatEff.Remove(StatusEffectEn.Cyclone);
                    StatEff.Remove(StatusEffectEn.FatalStrike);
                    StatEff.Remove(StatusEffectEn.BlueName);
                    StatEff.Remove(StatusEffectEn.Flashy);
                    StatEff.Remove(StatusEffectEn.ShurikenVortex);
                    BlueName = false;
                    StatEff.Remove(StatusEffectEn.SuperMan);
                    StatEff.Remove(StatusEffectEn.XPStart);
                    StatEff.Remove(StatusEffectEn.Ride);
                    StatEff.Add(StatusEffectEn.Dead);
                    DeathHit = DateTime.Now;

                    if (PKPoints >= 100)
                        World.SendMsgToAll("SYSTEM", Attacker.Name + " has captured " + Name + " and sent him to jail.", 2000, 0);
                }
            }
        }
09/15/2010 11:53 salem rey#6
THanks hopes this works :D
09/15/2010 16:15 pro4never#7
actually just remove bow attack type and archer attack skills. That way archers can still attack with a sword or w/e if they wanted to for some reason.
09/15/2010 22:11 dowhatuwant#8
or remove archers, hell ye
09/15/2010 22:32 pro4never#9
well I ASSUME this is for some sort of an event vs just not letting archers attack on the server... cause that would make little/no sense...

If you are talking about for an event.. just do something in the attack packet handler such as..


if(GC.MyClient.Map == X && Type = 28)
return;

(assuming bow = type 28 now? I forget)
09/15/2010 23:27 dowhatuwant#10
Quote:
Originally Posted by pro4never View Post
well I ASSUME this is for some sort of an event vs just not letting archers attack on the server... cause that would make little/no sense...

If you are talking about for an event.. just do something in the attack packet handler such as..


if(GC.MyClient.Map == X && Type = 28)
return;

(assuming bow = type 28 now? I forget)
just use GC.MyChar.Equips.RightHand.ID
:P