منتدي اكواد

منتدي اكواد (https://code.vpscairo.com/index.php)
-   تطوير سيرفرات كونكر (https://code.vpscairo.com/forumdisplay.php?f=11)
-   -   سستم اتاكات سرفر Devil Power فكسد 100% (https://code.vpscairo.com/showthread.php?t=4479)

MahmoudMano 2020-04-19 07:04 PM

سستم اتاكات سرفر Devil Power فكسد 100%
 
السلام عليكم ورحمه الله وبركاتو

النهارضه معايا موضوع مهم جدا جدا وهوا اتاكات يعني معظم مشاكل الناس فيها وانا النهارضه هنزلكم كل الاتكات فكسد لكل الشخصيات ومتحدد قيم فيها لكل التبرعات حتي اللي مش متبرع وباذن الله هيعجبكم نخش بقا علي المفيد



كود PHP:

using System;
using System.Collections.Generic;
using System.Threading.Tasks;
using System.Linq;
using System.Text;
using Mr_Panda.Network.GamePackets;
using Mr_Panda.Game.ConquerStructures;
using Mr_Panda.Network;
using Mr_Panda.Interfaces;
using System.Drawing;
using Mr_Panda.Database;
using Mr_Panda.Copra;
using Mr_Panda.Game.Features.Tournaments;
using Mr_Panda.MaTrix;

namespace 
Mr_Panda.Game.Attacking
{
    public class 
Handle
    
{
        public static List<
LocationGetLocation(int Xint Y)
        {
            List<
LocationmyList = new List<Location>();
            var 
distance 6;

            
myList.Add(new Location() { = (short)(+ -distance), = (short)(+ -distance) });
            
myList.Add(new Location() { = (short)(+ -distance), = (short)(distance) });
            
myList.Add(new Location() { = (short)(distance), = (short)(distance) });
            
myList.Add(new Location() { = (short)(distance), = (short)(+ -distance) });
            return 
myList;
        }
        public static List<
LocationGetLocation2(int Xint Y)
        {
            List<
LocationmyList = new List<Location>();
            var 
distance 6;

            
myList.Add(new Location() { = (short)(+ -distance), = (short)(+ -distance) });
            
myList.Add(new Location() { = (short)(+ -distance), = (short)(distance) });
            
//myList.Add(new Location() { X = (short)(X + distance), Y = (short)(Y + distance) });
            
myList.Add(new Location() { = (short)(distance), = (short)(+ -distance) });
            return 
myList;
        }
        public 
struct Location
        
{
            public 
short X;
            public 
short Y;
        }
        private 
Attack attack;
        private 
Entity attackerattacked;
        public 
Handle(Attack attackEntity attackerEntity attacked)
        {
            try
            {
                
this.attack attack;
                
this.attacker attacker;
                
this.attacked attacked;
                
this.Execute();
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
            }
        }
        
#region Interations
        
public class InteractionRequest
        
{
            public 
InteractionRequest(Network.GamePackets.Attack attackGame.Entity a_client)
            {
                
Client.GameState client a_client.Owner;

                
client.Player.InteractionInProgress false;
                
client.Player.InteractionWith attack.Attacked;
                
client.Player.InteractionType 0;
                
client.InteractionEffect attack.ResponseDamage;

                if (
Kernel.GamePool.ContainsKey(attack.Attacked))
                {
                    
Client.GameState clienttarget Kernel.GamePool[attack.Attacked];
                    
clienttarget.Player.InteractionInProgress false;
                    
clienttarget.Player.InteractionWith client.Player.UID;
                    
clienttarget.Player.InteractionType 0;
                    
clienttarget.InteractionEffect attack.ResponseDamage;
                    
attack.Attacker client.Player.UID;
                    
attack.clienttarget.Player.X;
                    
attack.clienttarget.Player.Y;
                    
attack.AttackType 46;
                    
clienttarget.Send(attack);
                    
clienttarget.Send(attack);
                }
            }
        }
        public class 
InteractionEffect
        
{
            public 
InteractionEffect(Network.GamePackets.Attack attackGame.Entity a_client)
            {
                
Client.GameState client a_client.Owner;

                if (
Kernel.GamePool.ContainsKey(client.Player.InteractionWith))
                {
                    
Client.GameState clienttarget Kernel.GamePool[client.Player.InteractionWith];

                    if (
clienttarget.Player.== client.Player.&& clienttarget.Player.== client.Player.Y)
                    {
                        
attack.Damage client.Player.InteractionType;
                        
attack.ResponseDamage client.InteractionEffect;
                        
clienttarget.Player.InteractionSet true;
                        
client.Player.InteractionSet true;
                        
attack.Attacker clienttarget.Player.UID;
                        
attack.Attacked client.Player.UID;
                        
attack.AttackType 47;
                        
attack.clienttarget.Player.X;
                        
attack.clienttarget.Player.Y;

                        
clienttarget.Send(attack);
                        
attack.AttackType 49;

                        
attack.Attacker client.Player.UID;
                        
attack.Attacked clienttarget.Player.UID;
                        
client.SendScreen(attacktrue);

                        
attack.Attacker clienttarget.Player.UID;
                        
attack.Attacked client.Player.UID;
                        
client.SendScreen(attacktrue);
                    }
                }
            }
        }
        public class 
InteractionAccept
        
{
            public 
InteractionAccept(Network.GamePackets.Attack attackGame.Entity a_client)
            {

                
Client.GameState client a_client.Owner;
                if (
client.Player.ContainsFlag(Network.GamePackets.Update.Flags.Ride))
                    
client.Player.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                if (
client.Player.InteractionWith != attack.Attacked)
                    return;
                
attack.ResponseDamage client.InteractionEffect;
                
client.Player.InteractionSet false;
                if (
Kernel.GamePool.ContainsKey(attack.Attacked))
                {
                    
Client.GameState clienttarget Kernel.GamePool[attack.Attacked];
                    if (
clienttarget.Player.ContainsFlag(Network.GamePackets.Update.Flags.Ride))
                        
clienttarget.Player.RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                    
clienttarget.Player.InteractionSet false;
                    if (
clienttarget.Player.InteractionWith != client.Player.UID)
                        return;
                    if (
clienttarget.Player.Body == 1003 || clienttarget.Player.Body == 1004)
                    {
                        
attack.Attacker client.Player.UID;
                        
attack.client.Player.X;
                        
attack.client.Player.Y;
                        
clienttarget.Send(attack);
                        
clienttarget.Player.InteractionInProgress true;
                        
client.Player.InteractionInProgress true;
                        
clienttarget.Player.InteractionType attack.Damage;
                        
clienttarget.Player.InteractionX client.Player.X;
                        
clienttarget.Player.InteractionY client.Player.Y;
                        
client.Player.InteractionType attack.Damage;
                        
client.Player.InteractionX client.Player.X;
                        
client.Player.InteractionY client.Player.Y;
                        if (
clienttarget.Player.== client.Player.&& clienttarget.Player.== client.Player.Y)
                        {
                            
attack.Damage client.Player.InteractionType;
                            
clienttarget.Player.InteractionSet true;
                            
client.Player.InteractionSet true;
                            
attack.Attacker clienttarget.Player.UID;
                            
attack.Attacked client.Player.UID;
                            
attack.AttackType 47;
                            
attack.clienttarget.Player.X;
                            
attack.clienttarget.Player.Y;
                            
attack.ResponseDamage clienttarget.InteractionEffect;
                            
clienttarget.Send(attack);
                            
attack.AttackType 49;
                            
attack.Attacker client.Player.UID;
                            
attack.Attacked clienttarget.Player.UID;
                            
client.SendScreen(attacktrue);
                            
attack.Attacker clienttarget.Player.UID;
                            
attack.Attacked client.Player.UID;
                            
client.SendScreen(attacktrue);
                        }
                    }
                    else
                    {
                        
attack.AttackType 47;
                        
attack.Attacker client.Player.UID;
                        
attack.client.Player.X;
                        
attack.client.Player.Y;
                        
clienttarget.Send(attack);
                        
clienttarget.Player.InteractionInProgress true;
                        
client.Player.InteractionInProgress true;
                        
clienttarget.Player.InteractionType attack.Damage;
                        
clienttarget.Player.InteractionX clienttarget.Player.X;
                        
clienttarget.Player.InteractionY clienttarget.Player.Y;
                        
client.Player.InteractionType attack.Damage;
                        
client.Player.InteractionX clienttarget.Player.X;
                        
client.Player.InteractionY clienttarget.Player.Y;
                        if (
clienttarget.Player.== client.Player.&& clienttarget.Player.== client.Player.Y)
                        {
                            
clienttarget.Player.InteractionSet true;
                            
client.Player.InteractionSet true;
                            
attack.Attacker clienttarget.Player.UID;
                            
attack.Attacked client.Player.UID;
                            
attack.clienttarget.Player.X;
                            
attack.clienttarget.Player.Y;
                            
attack.ResponseDamage clienttarget.InteractionEffect;
                            
clienttarget.Send(attack);
                            
attack.AttackType 49;
                            
client.SendScreen(attacktrue);
                            
attack.Attacker client.Player.UID;
                            
attack.Attacked clienttarget.Player.UID;
                            
client.SendScreen(attacktrue);
                        }
                    }
                }
            }
        }
        public class 
InteractionStopEffect
        
{
            public 
InteractionStopEffect(Network.GamePackets.Attack attackGame.Entity a_client)
            {
                
Client.GameState client a_client.Owner;

                if (
Kernel.GamePool.ContainsKey(attack.Attacked))
                {
                    
Client.GameState clienttarget Kernel.GamePool[attack.Attacked];
                    
attack.Attacker client.Player.UID;
                    
attack.Attacked clienttarget.Player.UID;
                    
attack.Damage client.Player.InteractionType;
                    
attack.client.Player.X;
                    
attack.client.Player.Y;
                    
attack.AttackType 50;
                    
client.SendScreen(attacktrue);
                    
attack.Attacker clienttarget.Player.UID; ;
                    
attack.Attacked client.Player.UID;
                    
clienttarget.SendScreen(attacktrue);
                    
client.Player.Teleport(client.Player.MapIDclient.Player.Xclient.Player.Y);
                    
clienttarget.Player.Teleport(clienttarget.Player.MapIDclienttarget.Player.Xclienttarget.Player.Y);
                    
client.Player.InteractionType 0;
                    
client.Player.InteractionWith 0;
                    
client.Player.InteractionInProgress false;
                    
clienttarget.Player.InteractionType 0;
                    
clienttarget.Player.InteractionWith 0;
                    
clienttarget.Player.InteractionInProgress false;
                }
            }
        }
        public class 
InteractionRefuse
        
{
            public 
InteractionRefuse(Network.GamePackets.Attack attackGame.Entity a_client)
            {
                
Client.GameState client a_client.Owner;

                
client.Player.InteractionType 0;
                
client.Player.InteractionWith 0;
                
client.Player.InteractionInProgress false;

                if (
Kernel.GamePool.ContainsKey(attack.Attacked))
                {
                    
Client.GameState clienttarget Kernel.GamePool[attack.Attacked];
                    
clienttarget.Player.InteractionType 0;
                    
clienttarget.Player.InteractionWith 0;
                    
clienttarget.Player.InteractionInProgress false;
                }
            }
        }
        
#endregion
        
public static void ShadowofChaser(Entity attackerEntity attackedAttack attackbyte oneortwo)
        {
            
#region ShadowofChaser(Active)
            
IMapObject lastAttacked attacked;
            if (
oneortwo == 1)
            {
                if (
attacker.ContainsFlag4(Update.Flags4.ShadowofChaser) && attacker.IsChaser2())
                {
                    
#region FloorItem
                    
var map Kernel.Maps[attacker.MapID];
                    
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
                    
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                    while (
map.Npcs.ContainsKey(flooritem.UID))
                        
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;

                    
flooritem.ItemID FloorItem.ShadowofChaser;
                    
flooritem.lastAttacked.X;
                    
flooritem.MapID attacker.MapID;
                    
flooritem.lastAttacked.Y;
                    
flooritem.Type FloorItem.Effect;
                    
flooritem.mColor 14;
                    
flooritem.FlowerType 3;
                    
flooritem.Unknown37 1;
                    
flooritem.Attack attack;
                    
flooritem.OwnerUID attacker.UID;
                    
flooritem.Owner attacker.Owner;
                    
flooritem.OwnerGuildUID attacker.GuildID;
                    
flooritem.OnFloor Time32.Now;
                    
flooritem.Name2 "ShadowofChaser";
                    
flooritem.ShadowofChaserAttacked attacked;
                    
flooritem.ShadowofChaserAttacker attacker;
                    
attacker.Owner.Map.AddFloorItem(flooritem);
                    
attacker.Owner.SendScreenSpawn(flooritemtrue);
                    
#endregion
                    
return;
                }
            }
            else if (
oneortwo == 2)
            {
                var 
spell Database.SpellTable.GetSpell(13090attacker.Owner);
                
SpellUse suse = new SpellUse(true);
                
suse.Attacker attacker.UID;
                
suse.Attacker1 attacker.UID;
                
suse.SpellID spell.ID;
                
suse.SpellLevel spell.Level;
                if (
CanAttack(attackerattackedspellfalse))
                {
                    
lastAttacked attacked;
                    
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack) * (spell.Power 30000) / 100;
                    
Handle.ReceiveAttack(attackerattackedattackref damagespell);
                    
suse.AddTarget(attackeddamagenull);
                }
                
attacker.Owner.SendScreen(susetrue);
                
SpellUse suse2 = new SpellUse(true);
                
suse2.Attacker attacker.UID;
                
suse2.SpellID spell.ID;
                
suse2.SpellLevel spell.Level;
                
suse2.attacked.X;
                
suse2.attacked.Y;
                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                {
                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                    {
                        if (
_obj == null) continue;
                        var 
attacked1 _obj as Entity;
                        if (
lastAttacked.UID == attacked1.UID) continue;
                        if (
Kernel.GetDistance(lastAttacked.XlastAttacked.Yattacked1.Xattacked1.Y) <= 4)
                        {
                            if (
CanAttack(attackerattacked1spellfalse))
                            {
                                
uint damage Game.Attacking.Calculate.Melee(attackerattacked1spellref attack) * (spell.Power 30000) / 100;
                                
ReceiveAttack(attackerattacked1attackref damagespell);
                                
suse2.AddTarget(attacked1damagenull);
                            }
                        }
                    }
                }
                
attacker.Owner.SendScreen(suse2true);
            }
            
#endregion
            
attacker.AttackPacket null;
        }
        public 
Entity findClosestTarget(Entity attackerushort Xushort YIEnumerable<Interfaces.IMapObject> Array)
        {
            
Entity closest attacker;
            
int dPrev 10000dist 0;
            foreach (var 
_obj in Array)
            {
                if (
_obj == null) continue;
                if (
_obj.MapObjType != MapObjectType.Entity && _obj.MapObjType != MapObjectType.Monster) continue;
                
dist Kernel.GetDistance(XY_obj.X_obj.Y);
                if (
dist dPrev)
                {
                    
dPrev dist;
                    
closest = (Entity)_obj;
                }
            }
            return 
closest;
        }
        public static 
IEnumerable<Client.GameStateEntityinRange(Entity attackerEntity attacked)
        {
            var 
dictionary Kernel.GamePool.Values.ToArray();
            return 
dictionary.Where((Entity) => Entity.Player.MapID == attacked.MapID && Kernel.GetDistance(Entity.Player.XEntity.Player.Yattacker.Xattacker.Y) <= 7);
        }
        public static 
void QuitSteedRace(Entity attacker)
        {
            
attacker.Owner.MessageBox("Do you want to quit the steed race?", (pClient) =>
            {
                
pClient.Player.Teleport(1002301279);
                
pClient.Player.RemoveFlag(Update.Flags.Ride);
            });
            
//attacker.Owner.Send(new NpcReply(NpcReply.MessageBox, "Do you want to quit the steed race?"));
            //attacker.Owner.MessageOK = (pClient) =>
            //{
            //    pClient.Entity.Teleport(1002, 301, 279);
            //    pClient.Entity.RemoveFlag(Update.Flags.Ride);
            //};
            //attacker.Owner.MessageCancel = null;
        
}
        public static List<
ushortGetWeaponSpell(SpellInformation spell)
        {
            return 
Database.SpellTable.WeaponSpells.Values.Where(=> p.Contains(spell.ID)).FirstOrDefault();

        }
        public static 
void RageOfWarTrap(FloorItem item)
        {
            var 
attack = new Attack(true);
            var 
spell Database.SpellTable.GetSpell(12930item.Owner);
            var 
suse = new SpellUse(true);
            
attack.Attacker suse.Attacker item.Owner.Player.UID;
            
attack.SpellID suse.SpellID spell.ID;
            
suse.item.X;
            
suse.item.Y;
            
suse.SpellLevel spell.Level;
            
suse.SpellEffect 1;
            
Sector sector = new Sector(item.Xitem.Yitem.Xitem.Y);
            
sector.Arrange(spell.Sector3);
            
Entity attacked null;
            foreach (
Interfaces.IMapObject _obj in item.Owner.Screen.Objects)
            {
                if (
_obj == null)
                    continue;
                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                {
                    
attacked _obj as Entity;
                    if (
sector.Inside(attacked.Xattacked.Y))
                    {
                        if (
CanAttack(item.Owner.Playerattackedspellattack.AttackType == Attack.Melee))
                        {
                            
attack.Effect1 Attack.AttackEffects1.None;
                            
uint damage Game.Attacking.Calculate.Melee(item.Owner.Playerattackedref attack);
                            
attack.Damage damage;
                            
suse.Effect1 attack.Effect1;
                            
ReceiveAttack(item.Owner.Playerattackedattackref damagespell);
                            
suse.AddTarget(attacked.UIDdamageattack);
                        }
                    }
                }
            }
            
item.Owner.SendScreen(susetrue);
        }
        public static 
IEnumerable<Client.GameStateEntityinRange(FloorItem itemint dist)
        {
            var 
dictionary Kernel.GamePool.Values.ToArray();
            return 
dictionary.Where((Entity) => Entity.Player.MapID == item.MapID && Kernel.GetDistance(Entity.Player.XEntity.Player.Yitem.Xitem.Y) <= dist).OrderBy(Entity => Kernel.GetDistance(Entity.Player.XEntity.Player.Yitem.Xitem.Y));
        }
        public static 
void StomperMelee(FloorItem itemushort SpellID)
        {
            
Attack attack = new Attack(true);
            
attack.Attacker item.Owner.Player.UID;
            var 
spell Database.SpellTable.GetSpell(SpellIDitem.Owner);
            
SpellUse suse = new SpellUse(true);
            
suse.Attacker SpellID == 12990 item.UID item.Owner.Player.UID;
            
suse.SpellID SpellID;
            
attack.SpellID suse.SpellLevel spell.Level;
            
suse.SpecialEffect 1;
            if (
SpellID == 12990)
            {
                
suse.item.Start;
                
suse.item.End;
                foreach (
Interfaces.IMapObject _obj in item.Owner.Screen.Objects)
                {
                    if (
_obj.MapObjType == MapObjectType.Monster)
                    {
                        if (
_obj == null) continue;
                        var 
attacked1 _obj as Entity;
                        if (
CanAttack(item.Owner.Playerattacked1spellfalse))
                        {
                            {
                                var 
spellange Enums.HorrorofStomperAngle(item.Angle);
                                
ushort xxxx item.X;
                                
ushort yyyy item.Y;
                                
Map.Pushback(ref xxxxref  yyyyspellange7);
                                
Fan sector = new Fan(item.Xitem.Yxxxxyyyyspell.Rangespell.Sector);
                                if (
sector.IsInFan(attacked1.Xattacked1.Y))
                                {
                                    var 
damage Game.Attacking.Calculate.Melee(item.Owner.Playerattacked1ref attack);
                                    
damage = (uint)(damage 0.6);
                                    
ReceiveAttack(item.Owner.Playerattacked1attackref damagespell);
                                    
suse.AddTarget(attacked1.UIDdamagenull);
                                    continue;
                                }
                            }
                            {
                                var 
spellange Enums.OppositeAngle(Enums.HorrorofStomperAngle(item.Angle));
                                
ushort xxxx item.X;
                                
ushort yyyy item.Y;
                                
Map.Pushback(ref xxxxref  yyyyspellange7);
                                
Fan sector = new Fan(item.Xitem.Yxxxxyyyyspell.Rangespell.Sector);
                                if (
sector.IsInFan(attacked1.Xattacked1.Y))
                                {
                                    var 
damage Game.Attacking.Calculate.Melee(item.Owner.Playerattacked1ref attack);
                                    
damage = (uint)(damage 0.6);
                                    
ReceiveAttack(item.Owner.Playerattacked1attackref damagespell);
                                    
item.Owner.IncreaseProficiencyExperience(Math.Min(damageattacked1.Hitpoints), 626);
                                    
suse.AddTarget(attacked1.UIDdamagenull);
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                
suse.item.X;
                
suse.item.Y;
                foreach (
Interfaces.IMapObject _obj in item.Owner.Screen.Objects)
                {
                    if (
_obj.MapObjType == MapObjectType.Monster)
                    {
                        if (
_obj == null) continue;
                        var 
attacked1 _obj as Entity;
                        if (
Kernel.GetDistance(item.Xitem.Yattacked1.Xattacked1.Y) <= spell.Range)
                        {
                            if (
CanAttack(item.Owner.Playerattacked1spellfalse))
                            {
                                var 
damage Game.Attacking.Calculate.Melee(item.Owner.Playerattacked1ref attack);
                                
damage = (uint)(damage 0.6);
                                
ReceiveAttack(item.Owner.Playerattacked1attackref damagespell);
                                
item.Owner.IncreaseProficiencyExperience(Math.Min(damageattacked1.Hitpoints), 626);
                                
suse.AddTarget(attacked1.UIDdamagenull);
                            }
                        }
                    }
                }
            }
            
item.Owner.SendScreen(suse.ToArray(), true);
            
item.Owner.Player.AttackPacket null;
        }
        public static 
void FlameLotus(FloorItem itemint count 0)
        {
            var 
client item.Owner;

            if (!
client.Spells.ContainsKey(12380))
                return;
            var 
spell SpellTable.GetSpell(client.Spells[12380].IDclient.Spells[12380].Level);
            if (
count == 0)
            {
                switch (
spell.Level)
                {
                    case 
0count 5; break;
                    case 
1count 8; break;
                    case 
2count 11; break;
                    case 
3count 14; break;
                    case 
4count 17; break;
                    case 
5count 20; break;
                    case 
6count 25; break;
                }
            }

            var 
targets EntityinRange(itemspell.Range).ToArray();
            
targets targets.Where(=> CanAttack(client.Playerp.Playernulltrue)).ToArray();
            
targets targets.Take(count).ToArray();

            var 
attack = new Attack(true);
            
attack.Attacker item.Owner.Player.UID;
            
attack.AttackType Attack.Melee;

            foreach (var 
target in targets)
            {

                
uint damage Game.Attacking.Calculate.Magic(client.Playertarget.Playerref attack);
                if (
client.Spells.ContainsKey(1002))
                {
                    var 
spell2 SpellTable.GetSpell(client.Spells[1002].IDclient.Spells[1002].Level);
                    
damage Game.Attacking.Calculate.Magic(client.Playertarget.Playerspell2ref attack);
                }

                
attack.Damage damage;
                
attack.Attacked target.Player.UID;
                
attack.target.Player.X;
                
attack.target.Player.Y;

                
ReceiveAttack(client.Playertarget.Playerattackref damagespell);
                
client.Player.AttackPacket null;
            }

        }
        public static 
void AuroraLotus(FloorItem itemint count 0)
        {
            var 
client item.Owner;

            if (!
client.Spells.ContainsKey(12370))
                return;

            var 
spell SpellTable.GetSpell(client.Spells[12370].IDclient.Spells[12370].Level);
            if (
count == 0)
            {
                switch (
spell.Level)
                {
                    case 
0count 5; break;
                    case 
1count 8; break;
                    case 
2count 11; break;
                    case 
3count 14; break;
                    case 
4count 17; break;
                    case 
5count 20; break;
                    case 
6count 25; break;
                }
            }

            var 
deads EntityinRange(itemspell.Range).Where(=> p.Player.Dead).ToArray();

            if (
client.Team != null)
                
deads deads.Where(=> client.Team.Contain(p.Player.UID)).ToArray();
            else if (
client.Guild != null)
                if (
client.Guild.Members != null && client.Guild.Ally != null)
                    
deads deads.Where(=> client.Guild.Members.ContainsKey(p.Player.UID) || client.Guild.Ally.ContainsKey(p.Player.GuildID)).ToArray();
                else
                    
deads deads.Where(=> client.Guild.ID == p.Player.GuildID).ToArray();
            
deads deads.Take(count).ToArray();

            if (
deads != null)
            {
                foreach (var 
player in deads)
                {
                    
player.Player.Action Mr_Panda.Game.Enums.ConquerAction.None;
                    
player.ReviveStamp Time32.Now;
                    
player.Attackable false;
                    
player.Player.TransformationID 0;
                    
player.Player.RemoveFlag(Update.Flags.Dead);
                    
client.Player.revhere 0;
                    
player.Player.RemoveFlag(Update.Flags.Ghost);
                    
player.Player.Hitpoints player.Player.MaxHitpoints;
                    
player.Player.Ressurect();

                    
player.BlessTouch(client);
                }
            }
        }
        private 
void TwilightAction(Entity attackerSpellUse suseSpellInformation spellushort Xushort Y)
        {
            
byte dist 18;
            var 
map attacker.Owner.Map;

            var 
algo = new InLineAlgorithm(attacker.XXattacker.YYdist);

            var 
count = (double)algo.lcoords.Count 3;
            
int i 1;
            
Program.World.DelayedTask.StartDelayedTask(() =>
            {
                var 
selected * (int)count;
                
selected Math.Min(algo.lcoords.Count 1selected);
                
= (ushort)algo.lcoords[selected].X;
                
= (ushort)algo.lcoords[selected].Y;


                
FloorItem floorItem = new FloorItem(true);
                
floorItem.ItemID FloorItem.Twilight;
                
floorItem.ItemColor = (Enums.Color)(1);
                
floorItem.MapID attacker.MapID;
                
floorItem.Type FloorItem.Effect;
                
floorItem.X;
                
floorItem.Y;
                
floorItem.OnFloor Time32.Now;
                
floorItem.Owner attacker.Owner;
                while (
map.Npcs.ContainsKey(floorItem.UID))
                    
floorItem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                
map.AddFloorItem(floorItem);

                
attacker.Owner.SendScreenSpawn(floorItemtrue);

                if (
!= 0)
                {
                    
Data data = new Network.GamePackets.Data(true);
                    
data.UID attacker.UID;
                    
data.X;
                    
data.Y;
                    
data.ID 434;
                    
data.wParam1 attacker.X;
                    
data.wParam2 attacker.Y;
                    
attacker.Owner.SendScreen(datatrue);

                    
//double percent = 1;
                    //switch (i)
                    //{
                    //    case 1:
                    //        percent = 0.92;
                    //        break;
                    //    case 2:
                    //        percent = 1.02;
                    //        break;
                    //    case 3:
                    //        percent = 1.2;
                    //        break;
                    //}


                    
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                    {
                        
bool hit false;
                        var 
selected2 Math.Max(01) * (int)count;
                        
selected2 Math.Min(algo.lcoords.Count 1selected2);
                        if (
Kernel.GetDistance(_obj.X_obj.Y, (ushort)algo.lcoords[selected].X, (ushort)algo.lcoords[selected].Y) <= 3)
                            
hit true;
                        
//for (int j = selected2; j < selected; j++)
                        //    if (Kernel.GetDistance(_obj.X, _obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= spell.Range)
                        //        hit = true;
                        
if (hit)
                        {
                            if (
_obj.MapObjType == MapObjectType.Monster)
                            {
                                
attacked _obj as Entity;
                                if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                {
                                    var 
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                    
ReceiveAttack(attackerattackedattackref damagespell);

                                    
suse.AddTarget(attackeddamageattack);
                                }
                            }
                            else if (
_obj.MapObjType == MapObjectType.Entity)
                            {
                                
attacked _obj as Entity;
                                if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                {
                                    var 
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                    
damage = (uint)(damage 0.7);
                                    
//damage = (uint)((double)(damage * percent));
                                    
ReceiveAttack(attackerattackedattackref damagespell);

                                    
suse.AddTarget(attackeddamageattack);
                                }
                            }
                            else if (
_obj.MapObjType == MapObjectType.SobNpc)
                            {
                                var 
attackedsob _obj as SobNpcSpawn;
                                if (
CanAttack(attackerattackedsobspell))
                                {
                                    var 
damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);

                                    
ReceiveAttack(attackerattackedsobattackdamagespell);

                                    
suse.AddTarget(attackedsobdamageattack);
                                }
                            }
                        }
                    }
                    if (
suse.Targets.Count 0)
                        
attacker.Owner.SendScreen(susetrue);
                    
suse.Targets.Clear();
                }
                
i++;
            }, 
02500);
        }
        private 
void Execute()
        {
            
#region interactions
            
if (attack != null)
            {
                switch (
attack.AttackType)
                {
                    case (
uint)Network.GamePackets.Attack.InteractionRequest:
                        new 
InteractionRequest(attackattacker);
                        return;
                    case (
uint)Network.GamePackets.Attack.InteractionEffect:
                        new 
InteractionEffect(attackattacker);
                        return;
                    case (
uint)Network.GamePackets.Attack.InteractionAccept:
                        new 
InteractionAccept(attackattacker);
                        return;
                    case (
uint)Network.GamePackets.Attack.InteractionRefuse:
                        new 
InteractionRefuse(attackattacker);
                        return;
                    case (
uint)Network.GamePackets.Attack.InteractionStopEffect:
                        new 
InteractionStopEffect(attackattacker);
                        return;
                }
            }
            
#endregion
            #region Monster -> Entity \ Monster
            
if (attack == null)
            {
                if (
attacker.EntityFlag != EntityFlag.Monster)
                    return;

                if (
attacked == null) return;
                if (
attacked.EntityFlag == EntityFlag.Entity)
                {
                    if (
attacker.Companion && attacker.Name != "Thundercloud")
                    {
                        if (
Constants.PKForbiddenMaps.Contains(attacker.MapID))
                            return;
                    }
                    
#region ThunderCloud
                    
if (attacker.Name == "Thundercloud")
                    {
                        
Console.WriteLine("Test 1");
                        if (
Kernel.GamePool.ContainsKey(attacker.OwnerUID))
                        {
                            
Console.WriteLine("Test 2");
                            var 
owner Kernel.GamePool[attacker.OwnerUID];
                            var 
spell Database.SpellTable.GetSpell(12840owner);
                            var 
spell2 Database.SpellTable.GetSpell(12970owner);
                            
byte percent 0;
                            if (
spell2 != null)
                            {
                                if (
spell2.Level == 0percent 130;
                                if (
spell2.Level == 1percent 140;
                                if (
spell2.Level == 2percent 150;
                                if (
spell2.Level == 3percent 160;
                                if (
spell2.Level == 4percent 170;
                                if (
spell2.Level == 5percent 180;
                                if (
spell2.Level == 6percent 200;
                            }
                            
attack = new Attack(true);
                            
attack.Attacker attacker.UID;
                            
attack.Attacked attacked.UID;
                            
attack.AttackType Network.GamePackets.Attack.Kill;
                            
attack.attacked.X;
                            
attack.attacked.Y;
                            
attack.Damage 1;
                            
uint damage2 = (uint)(Calculate.Melee(owner.Playerattackedref attack) * spell.FirstDamage 100);
                            if (
attacker.SpawnPacket[50] == 128)//ThunderBolt
                                
damage2 = (uint)(damage2 percent 100);
                            
SpellUse suse2 = new SpellUse(true);
                            
suse2.Attacker attacker.UID;
                            
suse2.Attacker1 attacked.UID;
                            
suse2.SpellID 13190;
                            
suse2.attacked.X;
                            
suse2.attacked.Y;
                            
suse2.AddTarget(attackeddamage2attack);
                            
attacker.MonsterInfo.SendScreen(suse2);
                            if (
attacked.Hitpoints <= damage2)
                            {
                                
attacked.Die(attacker);
                                
attack.ResponseDamage damage2;
                                
attacker.MonsterInfo.SendScreen(attack);
                            }
                            else
                            {
                                
attacked.Hitpoints -= damage2;
                            }
                            return;
                        }
                        else
                            return;
                    }
                    
#endregion
                    #region ThunderCloudSight
                    
if (attacker != null && Kernel.Maps[attacker.MapID] != null)
                    {
                        foreach (var 
th in Kernel.Maps[attacker.MapID].Entities.Values.Where(=> i.Name == "Thundercloud"))
                        {
                            if (
th.OwnerUID == attacked.UID)
                            {
                                if (
attacker == null || Kernel.GetDistance(attacker.Xattacker.Yth.Xth.Y) > th.MonsterInfo.AttackRange || attacker.Dead) break;
                                
th.MonsterInfo.InSight attacker.UID;
                                break;
                            }
                        }
                    }
                    
#endregion

                    
if (!attacked.Owner.Attackable)
                        return;
                    if (
attacked.Dead)
                        return;
                    
//#region BackFire
                    //if (attacked.ContainsFlag3(Network.GamePackets.Update.Flags3.BackFire))
                    //{
                    //    attacked.RemoveFlag3(Update.Flags3.BackFire);
                    //    var spellz = Database.SpellTable.GetSpell(12680, attacker.Owner);
                    //    var attackz = new Attack(true);
                    //    attackz.Attacker = attacked.UID;
                    //    attackz.Attacked = attacker.UID;
                    //    uint damages = attacked.Hitpoints / 110 * (uint)(spellz != null ? spellz.Power : 0);
                    //    if (damages > 40000) damages = 40000;
                    //    attackz.Damage = damages;
                    //    attackz.AttackType = 57;

                    //    attacked.Owner.SendScreen(attackz, true);

                    //    if (attacker.Hitpoints <= damages)
                    //    {
                    //        attacker.Die(attacked);
                    //    }

                    //    else
                    //    {
                    //        attacker.Hitpoints -= damages;

                    //    }
                    //    if (attacked.Stamina <= ((attacked.HeavenBlessing > 0) ? 150 : 100))
                    //    {
                    //        attacked.Stamina += 30;
                    //    }
                    //    else attacked.Stamina = (byte)((attacked.HeavenBlessing > 0) ? 150 : 100);
                    //    return;
                    //}
                    //#endregion

                    
if (attacker.Mesh == 952)
                    {
                        
attacker.MonstersSpells = new List<ushort>()
                        {
                             
10363,// ca scateru cred
                             
10364,//doar attack
                             
10360,//range 10
                             
10362,//range 13
                             
10361//range 6
                        
};

                        
//this.Timer = Map.MonsterTimers.Add(this);
                    
}
                    if (
attacker.Mesh == 951)
                    {
                        
attacker.MonstersSpells = new List<ushort>()
                            {
                                
10372,
                                
10373,
                                
30012,
                                
30014,
                                
30013,
                                
30011
                            
};
                    }
                    if (
attacker.Mesh == 984)
                    {
                        
attacker.MonstersSpells = new List<ushort>()
                        {
                            
7
                            
20
                            
21
                            
10372,
                            
10373,
                            
30012,
                            
30014,
                            
30013,
                            
30011 
                        
};
                    }
                    
#region NemesisTyrant
                    
if (attacker.Name == "RoyalCamle")
                    {

                        
uint rand = (uint)Mr_Panda.Kernel.Random.Next(14);
                        switch (
rand)
                        {
                            case 
1:
                                
attacker.MonsterInfo.SpellID 10001;
                                break;
                            case 
2:
                                
attacker.MonsterInfo.SpellID 30010;
                                break;
                            case 
3:
                                
attacker.MonsterInfo.SpellID 10001;
                                break;
                            case 
4:
                                
attacker.MonsterInfo.SpellID 30010;
                                break;
                        }
                        if (
Kernel.Rate(5))
                        {
                            
attacker.MonsterInfo.SpellID 30011;
                        }
                        if (
Kernel.Rate(5))
                        {
                            
attacker.MonsterInfo.SpellID 30012;
                        }

                        
#region IceThrom AngerCop
                        
if (attacker.MonsterInfo.SpellID == 30010 || attacker.MonsterInfo.SpellID == 10001)
                        {
                            
uint damage 0;
                            
damage += (uint)Kernel.Random.Next(1500020000);
                            if (
attacked.Hitpoints <= damage)
                            {
                                
attacked.Die(attacker);
                            }
                            else
                            {
                                
attacked.Hitpoints -= damage;
                            }
                            if (
attacker.Companion)
                                
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);
                            
SpellUse suse = new SpellUse(true);
                            
suse.Attacker attacker.UID;
                            
suse.SpellID attacker.MonsterInfo.SpellID;
                            
suse.attacked.X;
                            
suse.attacked.Y;
                            
suse.AddTarget(attacked.UIDdamageattack);
                            
attacked.Owner.SendScreen(susetrue);
                        }
                        
#endregion
                        #region Chill
                        
if (attacker.MonsterInfo.SpellID == 30011)
                        {
                            
SpellUse suse = new SpellUse(true);
                            
attack = new Attack(true);
                            
attack.Effect1 Attack.AttackEffects1.None;
                            
uint damage 0;
                            
damage += (uint)Kernel.Random.Next(27005000);
                            
suse.Effect1 attack.Effect1;
                            if (
attacked.Hitpoints <= damage)
                            {
                                
attacked.Die(attacker);
                            }
                            else
                            {
                                
attacked.Hitpoints -= damage;
                                
attacked.Owner.ChaosStamp Time32.Now;
                                
attacked.Owner.Player.ChaosTime 5;
                                var 
upd = new GameCharacterUpdates(true);
                                
upd.UID attacked.UID;
                                
upd.Add(GameCharacterUpdates.Flustered05);
                                
attacked.Owner.SendScreen(updtrue);
                                
attacked.Owner.Player.AddFlag(Update.Flags.Confused);

                            }
                            if (
attacker.Companion)
                                
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);

                            
suse.Attacker attacker.UID;
                            
suse.SpellID attacker.MonsterInfo.SpellID;
                            
suse.attacked.X;
                            
suse.attacked.Y;
                            
suse.AddTarget(attacked.UIDdamageattack);
                            foreach (var 
obj in attacked.Owner.Screen.Objects)
                            {
                                if (
Calculations.InBox(obj.Xobj.Yattacker.Xattacker.Y14))
                                {
                                    if (
obj.MapObjType == MapObjectType.Entity)
                                    {
                                        if (
obj.Owner.Player.ContainsFlag(Update.Flags.Dead))
                                            continue;
                                        
attacked obj as Entity;
                                        if (
attacked.Hitpoints <= damage)
                                        {
                                            
attacked.Die(attacker);
                                        }
                                        else
                                        {
                                            
attacked.Hitpoints -= damage;
                                            
attacked.Owner.ChaosStamp Time32.Now;
                                            
attacked.Owner.Player.ChaosTime 10;
                                            var 
upd = new GameCharacterUpdates(true);
                                            
upd.UID attacked.UID;
                                            
upd.Add(GameCharacterUpdates.Flustered010);
                                            
attacked.Owner.SendScreen(updtrue);
                                            
attacked.Owner.Player.AddFlag(Update.Flags.Confused);
                                        }

                                        
suse.AddTarget(attacked.UIDdamageattack);
                                    }
                                }
                            }
                            
attacked.Owner.SendScreen(susetrue);
                        }
                        
#endregion
                        #region AngerCrop
                        
if (attacker.MonsterInfo.SpellID == 30012)
                        {
                            
SpellUse suse = new SpellUse(true);
                            
attack = new Attack(true);
                            
attack.Effect1 Attack.AttackEffects1.None;
                            
uint damage 0;
                            
damage += (uint)Kernel.Random.Next(27005000);
                            
suse.Effect1 attack.Effect1;
                            if (
attacked.Hitpoints <= damage)
                            {
                                
attacked.Die(attacker);
                            }
                            else
                            {
                                
attacked.Hitpoints -= damage;
                                
attacked.Owner.Player.BlockStamp Time32.Now;
                                
attacked.Owner.Player.BlockTime 5;
                                
GameCharacterUpdates update = new GameCharacterUpdates(true);
                                
update.UID attacked.UID;
                                
update.Add(GameCharacterUpdates.Freeze05);
                                
attacked.Owner.SendScreen(updatetrue);
                                
attacked.AddFlag(Update.Flags.Freeze);
                            }
                            if (
attacker.Companion)
                                
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);

                            
suse.Attacker attacker.UID;
                            
suse.SpellID attacker.MonsterInfo.SpellID;
                            
suse.attacked.X;
                            
suse.attacked.Y;
                            
suse.AddTarget(attacked.UIDdamageattack);
                            foreach (var 
obj in attacked.Owner.Screen.Objects)
                            {
                                if (
Calculations.InBox(obj.Xobj.Yattacker.Xattacker.Y10))
                                {
                                    if (
obj.MapObjType == MapObjectType.Entity)
                                    {
                                        if (
obj.Owner.Player.ContainsFlag(Update.Flags.Dead))
                                            continue;
                                        
attacked obj as Entity;
                                        if (
attacked.Hitpoints <= damage)
                                        {
                                            
attacked.Die(attacker);
                                        }
                                        else
                                        {
                                            
attacked.Hitpoints -= damage;
                                            
attacked.Owner.Player.BlockStamp Time32.Now;
                                            
attacked.Owner.Player.BlockTime 5;
                                            
GameCharacterUpdates update = new GameCharacterUpdates(true);
                                            
update.UID attacked.UID;
                                            
update.Add(GameCharacterUpdates.Freeze05);
                                            
attacked.Owner.SendScreen(updatetrue);
                                            
attacked.AddFlag(Update.Flags.Freeze);
                                        }

                                        
suse.AddTarget(attacked.UIDdamageattack);
                                    }
                                }
                            }
                            
attacked.Owner.SendScreen(susetrue);
                        }
                        
#endregion

                    
}

                    
#endregion
                    #region NemesisTyrant
                    
if (attacker.Name == "GuildWarMonster")
                    {

                        
uint rand = (uint)Mr_Panda.Kernel.Random.Next(14);
                        switch (
rand)
                        {
                            case 
1:
                                
attacker.MonsterInfo.SpellID 10001;
                                break;
                            case 
2:
                                
attacker.MonsterInfo.SpellID 30010;
                                break;
                            case 
3:
                                
attacker.MonsterInfo.SpellID 10001;
                                break;
                            case 
4:
                                
attacker.MonsterInfo.SpellID 30010;
                                break;
                        }
                        if (
Kernel.Rate(5))
                        {
                            
attacker.MonsterInfo.SpellID 30011;
                        }
                        if (
Kernel.Rate(5))
                        {
                            
attacker.MonsterInfo.SpellID 30012;
                        }

                        
#region IceThrom AngerCop
                        
if (attacker.MonsterInfo.SpellID == 30010 || attacker.MonsterInfo.SpellID == 10001)
                        {
                            
uint damage 0;
                            
damage += (uint)Kernel.Random.Next(800010000);
                            if (
attacked.Hitpoints <= damage)
                            {
                                
attacked.Die(attacker);
                            }
                            else
                            {
                                
attacked.Hitpoints -= damage;
                            }
                            if (
attacker.Companion)
                                
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);
                            
SpellUse suse = new SpellUse(true);
                            
suse.Attacker attacker.UID;
                            
suse.SpellID attacker.MonsterInfo.SpellID;
                            
suse.attacked.X;
                            
suse.attacked.Y;
                            
suse.AddTarget(attacked.UIDdamageattack);
                            
attacked.Owner.SendScreen(susetrue);
                        }
                        
#endregion
                        #region Chill
                        
if (attacker.MonsterInfo.SpellID == 30011)
                        {
                            
SpellUse suse = new SpellUse(true);
                            
attack = new Attack(true);
                            
attack.Effect1 Attack.AttackEffects1.None;
                            
uint damage 0;
                            
damage += (uint)Kernel.Random.Next(27005000);
                            
suse.Effect1 attack.Effect1;
                            if (
attacked.Hitpoints <= damage)
                            {
                                
attacked.Die(attacker);
                            }
                            else
                            {
                                
attacked.Hitpoints -= damage;
                                
attacked.Owner.ChaosStamp Time32.Now;
                                
attacked.Owner.Player.ChaosTime 5;
                                var 
upd = new GameCharacterUpdates(true);
                                
upd.UID attacked.UID;
                                
upd.Add(GameCharacterUpdates.Flustered05);
                                
attacked.Owner.SendScreen(updtrue);
                                
attacked.Owner.Player.AddFlag(Update.Flags.Confused);

                            }
                            if (
attacker.Companion)
                                
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);

                            
suse.Attacker attacker.UID;
                            
suse.SpellID attacker.MonsterInfo.SpellID;
                            
suse.attacked.X;
                            
suse.attacked.Y;
                            
suse.AddTarget(attacked.UIDdamageattack);
                            foreach (var 
obj in attacked.Owner.Screen.Objects)
                            {
                                if (
Calculations.InBox(obj.Xobj.Yattacker.Xattacker.Y14))
                                {
                                    if (
obj.MapObjType == MapObjectType.Entity)
                                    {
                                        if (
obj.Owner.Player.ContainsFlag(Update.Flags.Dead))
                                            continue;
                                        
attacked obj as Entity;
                                        if (
attacked.Hitpoints <= damage)
                                        {
                                            
attacked.Die(attacker);
                                        }
                                        else
                                        {
                                            
attacked.Hitpoints -= damage;
                                            
attacked.Owner.ChaosStamp Time32.Now;
                                            
attacked.Owner.Player.ChaosTime 10;
                                            var 
upd = new GameCharacterUpdates(true);
                                            
upd.UID attacked.UID;
                                            
upd.Add(GameCharacterUpdates.Flustered010);
                                            
attacked.Owner.SendScreen(updtrue);
                                            
attacked.Owner.Player.AddFlag(Update.Flags.Confused);
                                        }

                                        
suse.AddTarget(attacked.UIDdamageattack);
                                    }
                                }
                            }
                            
attacked.Owner.SendScreen(susetrue);
                        }
                        
#endregion
                        #region AngerCrop
                        
if (attacker.MonsterInfo.SpellID == 30012)
                        {
                            
SpellUse suse = new SpellUse(true);
                            
attack = new Attack(true);
                            
attack.Effect1 Attack.AttackEffects1.None;
                            
uint damage 0;
                            
damage += (uint)Kernel.Random.Next(27005000);
                            
suse.Effect1 attack.Effect1;
                            if (
attacked.Hitpoints <= damage)
                            {
                                
attacked.Die(attacker);
                            }
                            else
                            {
                                
attacked.Hitpoints -= damage;
                                
attacked.Owner.Player.BlockStamp Time32.Now;
                                
attacked.Owner.Player.BlockTime 5;
                                
GameCharacterUpdates update = new GameCharacterUpdates(true);
                                
update.UID attacked.UID;
                                
update.Add(GameCharacterUpdates.Freeze05);
                                
attacked.Owner.SendScreen(updatetrue);
                                
attacked.AddFlag(Update.Flags.Freeze);
                            }
                            if (
attacker.Companion)
                                
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);

                            
suse.Attacker attacker.UID;
                            
suse.SpellID attacker.MonsterInfo.SpellID;
                            
suse.attacked.X;
                            
suse.attacked.Y;
                            
suse.AddTarget(attacked.UIDdamageattack);
                            foreach (var 
obj in attacked.Owner.Screen.Objects)
                            {
                                if (
Calculations.InBox(obj.Xobj.Yattacker.Xattacker.Y10))
                                {
                                    if (
obj.MapObjType == MapObjectType.Entity)
                                    {
                                        if (
obj.Owner.Player.ContainsFlag(Update.Flags.Dead))
                                            continue;
                                        
attacked obj as Entity;
                                        if (
attacked.Hitpoints <= damage)
                                        {
                                            
attacked.Die(attacker);
                                        }
                                        else
                                        {
                                            
attacked.Hitpoints -= damage;
                                            
attacked.Owner.Player.BlockStamp Time32.Now;
                                            
attacked.Owner.Player.BlockTime 5;
                                            
GameCharacterUpdates update = new GameCharacterUpdates(true);
                                            
update.UID attacked.UID;
                                            
update.Add(GameCharacterUpdates.Freeze05);
                                            
attacked.Owner.SendScreen(updatetrue);
                                            
attacked.AddFlag(Update.Flags.Freeze);
                                        }

                                        
suse.AddTarget(attacked.UIDdamageattack);
                                    }
                                }
                            }
                            
attacked.Owner.SendScreen(susetrue);
                        }
                        
#endregion

                    
}

                    
#endregion
                    
if (attacker.MonstersSpells != null)
                    {
                        
ushort usespell 0;
                        
byte rand = (byte)Kernel.Random.Next(0attacker.MonstersSpells.Count);
                        if (
rand >= attacker.MonstersSpells.Count)
                            
usespell attacker.MonstersSpells[0];
                        
usespell attacker.MonstersSpells[rand];

                        
this.attack = new Attack(true);
                        
this.attack.Effect1 Attack.AttackEffects1.None;
                        
this.attack = new Attack(true);
                        
this.attack.Attacker this.attacker.UID;
                        
this.attack.Attacked this.attacker.MonsterInfo.ID;
                        
this.attack.this.attacked.X;
                        
this.attack.this.attacked.Y;
                        
this.attack.AttackType 52;
                        
this.attack.SpellID usespell;
                        
this.attacker.MonsterInfo.SendScreen(this.attack);
                        
attacker.MonsterInfo.SpellID usespell;

                        switch (
usespell)
                        {
                            case 
7:
                                
attacker.MonsterInfo.SpellID 10361;
                                
attacked.AddFlag((ulong)Update.Flags.Stun);
                                
attacked.ShockStamp Time32.Now;
                                
attacked.Shock 5;
                                var 
upd1 = new GameCharacterUpdates(true);
                                
upd1.UID attacked.UID;
                                
upd1.Add(GameCharacterUpdates.SoulShacle05);
                                
attacked.Owner.SendScreen(upd1true);
                                break;
                            case 
20:
                                
attacker.MonsterInfo.SpellID 10360;
                                
attacked.AddFlag((ulong)Update.Flags.Stun);
                                
attacked.ShockStamp Time32.Now;
                                
attacked.Shock 5;
                                var 
upd = new GameCharacterUpdates(true);
                                
upd.UID attacked.UID;
                                
upd.Add(GameCharacterUpdates.Dizzy05);
                                
attacked.Owner.SendScreen(updtrue);
                                break;
                            case 
21:
                                
attacker.MonsterInfo.SpellID 10361;
                                
attacked.AddFlag((ulong)Update.Flags.Stun);
                                
attacked.ShockStamp Time32.Now;
                                
attacked.Shock 5;
                                
upd1 = new GameCharacterUpdates(true);
                                
upd1.UID attacked.UID;
                                
upd1.Add(GameCharacterUpdates.Dizzy05);
                                
attacked.Owner.SendScreen(upd1true);
                                break;
                            
//bamsher
                            
case 10372:
                            case 
10373:
                            case 
30012:
                            case 
30014:
                            case 
30013:
                            case 
30011:


                            case 
10364:
                            case 
10363:
                            case 
10360:
                            case 
10361:
                            case 
10362:

                            default:
                                {
                                    {
                                        var 
Inrage EntityinRange(attackerattacked);
                                        
SpellUse suse = new SpellUse(true);
                                        
attack = new Attack(true);

                                        
bool geteffect = (Kernel.Random.Next() % 100) > 50;
                                        if (
geteffect)
                                            
attack.Effect1 Attack.AttackEffects1.WaterResist;
                                        else
                                            
attack.Effect1 Attack.AttackEffects1.None;

                                        
suse.Effect1 attack.Effect1;

                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID usespell;
                                        
suse.attacked.X;
                                        
suse.attacked.Y;
                                        foreach (var 
attk in Inrage)
                                        {
                                            var 
attackedd attk.Player;
                                            if (
attackedd.Dead)
                                                continue;
                                            if (
attackedd.ContainsFlag(Update.Flags.Stun))
                                                continue;
                                            if (
attackedd.ContainsFlag(Update.Flags.ChaosCycle))
                                                continue;
                                            if (
attackedd.ContainsFlag(Update.Flags.Freeze))
                                                continue;
                                            if (
attackedd.ContainsFlag(Update.Flags.FreezeSmall))
                                                continue;
                                            if (
attackedd.ContainsFlag(Update.Flags.Frightened))
                                                continue;
                                            
uint damage Calculate.CalculateBossDamage(attackerattackedusespell);//Calculate.Magic(attacker, attk.Entity, usespell, 0, ref attack);
                                            
if (attackedd.Hitpoints <= damage)
                                            {
                                                
attackedd.Die(attacker);
                                            }
                                            else
                                            {
                                                
#region Chill
                                                
if (attacker.MonsterInfo.SpellID == 30011)
                                                {
                                                    
attackedd.Hitpoints -= damage;
                                                    
attackedd.Owner.FrightenStamp Time32.Now;
                                                    
upd = new GameCharacterUpdates(true);
                                                    
upd.UID attackedd.UID;
                                                    
upd.Add(GameCharacterUpdates.Flustered05);
                                                    
attackedd.Owner.SendScreen(updtrue);
                                                    
attackedd.Owner.Player.AddFlag((ulong)Update.Flags.ChaosCycle);
                                                }
                                                
#endregion
                                                #region AngerCrop
                                                
else if (attacker.MonsterInfo.SpellID == 30012)
                                                {
                                                    
attackedd.Owner.Player.FrozenStamp Time32.Now;
                                                    
attackedd.Owner.Player.FrozenTime 5;
                                                    
GameCharacterUpdates update = new GameCharacterUpdates(true);
                                                    
update.UID attackedd.UID;
                                                    
update.Add(GameCharacterUpdates.Freeze05);
                                                    
attackedd.Owner.SendScreen(updatetrue);
                                                    
attackedd.AddFlag(Update.Flags.Freeze);
                                                }
                                                
#endregion
                                                #region 2nd skill
                                                
else if (attacker.MonsterInfo.SpellID == 7013)
                                                {
                                                    
attackedd.Owner.FrightenStamp Time32.Now;
                                                    
attackedd.Owner.Player.Fright 5;
                                                    
upd = new GameCharacterUpdates(true);
                                                    
upd.UID attackedd.UID;
                                                    
upd.Add(GameCharacterUpdates.Dizzy05);
                                                    
attackedd.Owner.SendScreen(updtrue);
                                                    
attackedd.Owner.Player.AddFlag((ulong)Update.Flags.FreezeSmall);
                                                }
                                                
#endregion
                                                
attackedd.Hitpoints -= damage;
                                            }
                                            
suse.AddTarget(attk.Playerdamageattack);
                                        }
                                        
attacked.Owner.SendScreen(susetrue);
                                    }
                                    break;
                                }
                        }
                        return;
                    }
                    else if (
attacker.MonsterInfo.SpellID == 0)// from this bracket to the next die delay replce this with urs
                    
{
                        
attack = new Attack(true);
                        
attack.Effect1 Attack.AttackEffects1.None;
                        
attack.AttackType Attack.Melee;
                        
uint damage Calculate.MonsterDamage(attackerattackedref attackfalse);
                        
//#region RevengeTaill
                        //if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
                        //{
                        //    if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
                        //    {
                        //        var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
                        //        if (damage <= spelll.Power)
                        //        {
                        //            SpellUse suses = new SpellUse(true);
                        //            suses.Attacker = attacked.UID;
                        //            suses.Attacker1 = attacker.UID;
                        //            suses.SpellID = 13030;
                        //            suses.SpellEffect = 1;
                        //            suses.AddTarget(attacker, damage, null);
                        //            if (attacker.Hitpoints <= damage)
                        //            {
                        //                attacker.Die(attacked);
                        //            }
                        //            else
                        //            {
                        //                attacker.Hitpoints -= damage;
                        //            }
                        //            attacked.Owner.SendScreen(suses, true);
                        //        }
                        //    }
                        //}
                        //#endregion
                        
attack.Attacker attacker.UID;
                        
attack.Attacked attacked.UID;
                        
attack.Damage damage;
                        
attack.attacked.X;
                        
attack.attacked.Y;

                        if (
attacked.Hitpoints <= damage)
                        {
                            
attacked.Owner.SendScreen(attacktrue);
                            
attacked.Die(attacker.UID);
                        }
                        else
                        {
                            
attacked.Hitpoints -= damage;
                            
attacked.Owner.SendScreen(attacktrue);
                        }
                    }
                    else
                    {
                        
SpellUse suse = new SpellUse(true);
                        
attack = new Attack(true);
                        
attack.Effect1 Attack.AttackEffects1.None;
                        
uint damage Calculate.MonsterDamage(attackerattackedattacker.MonsterInfo.SpellID);
                        
//#region RevengeTaill
                        //if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
                        //{
                        //    if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
                        //    {
                        //        var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
                        //        if (damage <= spelll.Power)
                        //        {
                        //            SpellUse suses = new SpellUse(true);
                        //            suses.Attacker = attacked.UID;
                        //            suses.Attacker1 = attacker.UID;
                        //            suses.SpellID = 13030;
                        //            suses.SpellEffect = 1;
                        //            suses.AddTarget(attacker, damage, null);
                        //            if (attacker.Hitpoints <= damage)
                        //            {
                        //                attacker.Die(attacked);
                        //            }
                        //            else
                        //            {
                        //                attacker.Hitpoints -= damage;
                        //            }
                        //            attacked.Owner.SendScreen(suses, true);
                        //        }
                        //    }
                        //}
                        //#endregion
                        
suse.Effect1 attack.Effect1;

                        if (
attacked.Hitpoints <= damage)
                        {
                            
attacked.Die(attacker.UID);
                        }
                        else
                        {
                            
attacked.Hitpoints -= damage;
                        }
                        if (
attacker.Companion)
                            
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);

                        
suse.Attacker attacker.UID;
                        
suse.SpellID attacker.MonsterInfo.SpellID;
                        
suse.attacked.X;
                        
suse.attacked.Y;
                        
suse.AddTarget(attackeddamageattack);
                        
attacked.Owner.SendScreen(susetrue);


                        
this.attack = new Attack(true);
                        
this.attack.Effect1 Attack.AttackEffects1.None;
                        
this.attack = new Attack(true);
                        
this.attack.Attacker this.attacker.UID;
                        
this.attack.Attacked this.attacker.MonsterInfo.ID;
                        
this.attack.this.attacked.X;
                        
this.attack.this.attacked.Y;
                        
this.attack.AttackType 52;
                        
this.attack.SpellID this.attacker.MonsterInfo.SpellID;
                        
this.attacker.MonsterInfo.SendScreen(this.attack);


                    }
                }
                else
                {
                    if (
attacker.MonsterInfo.SpellID == 0)
                    {
                        
attack = new Attack(true);
                        
attack.Effect1 Attack.AttackEffects1.None;
                        
attack.AttackType Attack.Melee;
                        
#region ThunderCloud
                        
if (attacker.Name == "Thundercloud")
                        {
                            if (
Kernel.GamePool.ContainsKey(attacker.OwnerUID))
                            {
                                var 
owner Kernel.GamePool[attacker.OwnerUID];
                                var 
spell Database.SpellTable.GetSpell(12840owner);
                                var 
spell2 Database.SpellTable.GetSpell(12970owner);
                                
uint damage2 = (uint)(Calculate.Melee(owner.Playerattackedref attack0) * (spell.Level spell.FirstDamage 50) / 100);
                                if (
attacker.SpawnPacket[50] == 128)
                                    
damage2 = (uint)(damage2 spell2.FirstDamage);
                                
SpellUse suse2 = new SpellUse(true);
                                
suse2.Attacker attacker.UID;
                                
suse2.Attacker1 attacked.UID;
                                
suse2.SpellID 13190;
                                
suse2.attacked.X;
                                
suse2.attacked.Y;
                                
suse2.AddTarget(attackeddamage2attack);
                                
attacker.MonsterInfo.SendScreen(suse2);
                                if (
attacked.Hitpoints <= damage2)
                                {
                                    
attacked.Die(attacker);
                                    
attack = new Attack(true);
                                    
attack.Attacker attacker.UID;
                                    
attack.Attacked attacked.UID;
                                    
attack.AttackType Network.GamePackets.Attack.Kill;
                                    
attack.attacked.X;
                                    
attack.attacked.Y;
                                    
attack.Damage 1;
                                    
attack.ResponseDamage damage2;
                                    
attacker.MonsterInfo.SendScreen(attack);
                                }
                                else
                                {
                                    
attacked.Hitpoints -= damage2;
                                }
                                return;
                            }
                            else
                                return;
                        }
                        
#endregion
                        
uint damage Calculate.MonsterDamage(attackerattackedref attackfalse);
                        
//#region RevengeTaill
                        //if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
                        //{
                        //    if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
                        //    {
                        //        var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
                        //        if (damage <= spelll.Power)
                        //        {
                        //            SpellUse suses = new SpellUse(true);
                        //            suses.Attacker = attacked.UID;
                        //            suses.Attacker1 = attacker.UID;
                        //            suses.SpellID = 13030;
                        //            suses.SpellEffect = 1;
                        //            suses.AddTarget(attacker, damage, null);
                        //            if (attacker.Hitpoints <= damage)
                        //            {
                        //                attacker.Die(attacked);
                        //            }
                        //            else
                        //            {
                        //                attacker.Hitpoints -= damage;
                        //            }
                        //            attacked.Owner.SendScreen(suses, true);
                        //        }
                        //    }
                        //}
                        //#endregion
                        
attack.Attacker attacker.UID;
                        
attack.Attacked attacked.UID;
                        
attack.Damage damage;
                        
attack.attacked.X;
                        
attack.attacked.Y;
                        
attacked.MonsterInfo.SendScreen(attack);
                        if (
attacker.Companion)
                            if (
damage attacked.Hitpoints)
                                
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);
                            else
                                
attacker.Owner.IncreaseExperience(damagetrue);
                        if (
attacked.Hitpoints <= damage)
                        {
                            
attacked.Die(attacker);
                            
attack = new Attack(true);
                            
attack.Attacker attacker.UID;
                            
attack.Attacked attacked.UID;
                            
attack.AttackType Network.GamePackets.Attack.Kill;
                            
attack.attacked.X;
                            
attack.attacked.Y;
                            
attacked.MonsterInfo.SendScreen(attack);
                        }
                        else
                        {
                            
attacked.Hitpoints -= damage;
                        }
                    }
                    else
                    {
                        
SpellUse suse = new SpellUse(true);
                        
attack = new Attack(true);


                        
attack.Effect1 Attack.AttackEffects1.None;

                        
uint damage Calculate.MonsterDamage(attackerattackedattacker.MonsterInfo.SpellID);
                        
//#region RevengeTaill
                        //if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
                        //{
                        //    if (attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
                        //    {
                        //        var spelll = Database.SpellTable.GetSpell(13030, attacked.Owner);
                        //        if (damage <= spelll.Power)
                        //        {
                        //            SpellUse suses = new SpellUse(true);
                        //            suses.Attacker = attacked.UID;
                        //            suses.Attacker1 = attacker.UID;
                        //            suses.SpellID = 13030;
                        //            suses.SpellEffect = 1;
                        //            suses.AddTarget(attacker, damage, null);
                        //            if (attacker.Hitpoints <= damage)
                        //            {
                        //                attacker.Die(attacked);
                        //            }
                        //            else
                        //            {
                        //                attacker.Hitpoints -= damage;
                        //            }
                        //            attacked.Owner.SendScreen(suses, true);
                        //        }
                        //    }
                        //}
                        //#endregion
                        
suse.Effect1 attack.Effect1;

                        
suse.Attacker attacker.UID;
                        
suse.SpellID attacker.MonsterInfo.SpellID;
                        
suse.attacked.X;
                        
suse.attacked.Y;
                        
suse.AddTarget(attackeddamageattack);
                        
attacked.MonsterInfo.SendScreen(suse);
                        if (
attacker.Companion)
                            if (
damage attacked.Hitpoints)
                                
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);
                            else
                                
attacker.Owner.IncreaseExperience(damagetrue);
                        if (
attacked.Hitpoints <= damage)
                        {
                            
attacked.Die(attacker);
                            
attack = new Attack(true);
                            
attack.Attacker attacker.UID;
                            
attack.Attacked attacked.UID;
                            
attack.AttackType Network.GamePackets.Attack.Kill;
                            
attack.attacked.X;
                            
attack.attacked.Y;
                            
attacked.MonsterInfo.SendScreen(attack);
                        }
                        else
                        {
                            
attacked.Hitpoints -= damage;
                        }
                    }
                }
            }
            
#endregion
            #region Entity -> Entity \ Monster \ Sob Npc
            
else
            {
                
#region Merchant
                
if (attack.AttackType == Attack.MerchantAccept || attack.AttackType == Attack.MerchantRefuse)
                {

                    
attacker.AttackPacket null;
                    return;
                }
                
#endregion
                #region Marriage
                
if (attack.AttackType == Attack.MarriageAccept || attack.AttackType == Attack.MarriageRequest)
                {
                    if (
attack.AttackType == Attack.MarriageRequest)
                    {
                        
Client.GameState Spouse null;
                        
uint takeout attack.Attacked;
                        if (
takeout == attacker.UID)
                            
takeout attack.Attacker;
                        if (
Kernel.GamePool.TryGetValue(takeoutout Spouse))
                        {
                            if (
attacker.Spouse != "None" || Spouse.Player.Spouse != "None")
                            {
                                
attacker.Owner.Send(new Message("You cannot marry someone that is already married with someone else!"System.Drawing.Color.BlackMessage.TopLeft));
                            }
                            else
                            {
                                
uint id1 attacker.Mesh 10id2 Spouse.Player.Mesh 10;

                                if (
id1 <= && id2 >= || id1 >= && id2 <= 3)
                                {

                                    
attack.Spouse.Player.X;
                                    
attack.Spouse.Player.Y;

                                    
Spouse.Send(attack);
                                }
                                else
                                {
                                    
attacker.Owner.Send(new Message("You cannot marry someone of your gender!"System.Drawing.Color.BlackMessage.TopLeft));
                                }
                            }
                        }
                    }
                    else
                    {
                        
Client.GameState Spouse null;
                        if (
Kernel.GamePool.TryGetValue(attack.Attackedout Spouse))
                        {
                            if (
attacker.Spouse != "None" || Spouse.Player.Spouse != "None")
                            {
                                
attacker.Owner.Send(new Message("You cannot marry someone that is already married with someone else!"System.Drawing.Color.BlackMessage.TopLeft));
                            }
                            else
                            {
                                if (
attacker.Mesh 10 <= && Spouse.Player.Mesh 10 >= || attacker.Mesh 10 >= && Spouse.Player.Mesh 10 <= 2)
                                {
                                    
Spouse.Player.Spouse attacker.Name;
                                    
attacker.Spouse Spouse.Player.Name;
                                    
Message message null;
                                    if (
Spouse.Player.Mesh 10 >= 3)
                                        
message = new Message("Joy and happiness! " Spouse.Player.Name " and " attacker.Name " have joined together in the holy marriage. We wish them a stone house."System.Drawing.Color.BurlyWoodMessage.Center);
                                    else
                                        
message = new Message("Joy and happiness! " attacker.Name " and " attacker.Spouse " have joined together in the holy marriage. We wish them a stone house."System.Drawing.Color.BurlyWoodMessage.Center);

                                    foreach (
Client.GameState client in Program.Values)
                                    {
                                        
client.Send(message);
                                    }

                                    
Spouse.Player.Update(_String.Effect"firework-2love"true);
                                    
attacker.Update(_String.Effect"firework-2love"true);
                                }
                                else
                                {
                                    
attacker.Owner.Send(new Message("You cannot marry someone of your gender!"System.Drawing.Color.BlackMessage.TopLeft));
                                }
                            }
                        }
                    }
                }
                
#endregion
                #region Attacking
                
else
                {
                    
attacker.Owner.Attackable true;
                    
Entity attacked null;

                    
SobNpcSpawn attackedsob null;
                    
FloorItem attackedItem null;

                    
#region Checks
                    
if (attack.Attacker != attacker.UID)
                        return;
                    if (
attacker.EntityFlag != EntityFlag.Entity)
                        return;
                    
attacker.RemoveFlag(Update.Flags.Invisibility);

                    
bool pass false;
                    if (
attack.AttackType == Attack.Melee)
                    {
                        if (
attacker.OnFatalStrike())
                        {
                            if (
attack.Attacked 600000)
                            {
                                
pass true;
                            }
                        }
                    }
                    
ushort decrease 0;
                    if (
attacker.OnCyclone())
                        
decrease 1;//Ahmed Samak :  to fix the cyclone in scatter issue .. the value replaced from 700 to 1;

                    
if (attacker.OnSuperman())
                        
decrease 300;
                    if (!
pass && attack.AttackType != Attack.Magic)
                    {
                        
int milliSeconds 1000 decrease;
                        if (
milliSeconds || milliSeconds 5000)
                            
milliSeconds 0;
                        if (
Time32.Now attacker.AttackStamp.AddMilliseconds(milliSeconds))
                            return;

                        
attacker.AttackStamp Time32.Now;
                    }
                    if (
attacker.Dead)
                    {
                        if (
attacker.AttackPacket != null)
                            
attacker.AttackPacket null;
                        return;
                    }
                    if (
attacker.Owner.InQualifier())
                    {
                        if (
Time32.Now attacker.Owner.ImportTime().AddSeconds(12))
                        {
                            return;
                        }
                    }
                    if (
attacker.Owner.ChampionGroup != null)
                    {
                        if (
Time32.Now attacker.Owner.ChampionGroup.ImportTime.AddSeconds(12))
                        {
                            return;
                        }
                    }
                    
bool doWep1Spell falsedoWep2Spell false;
                
restart:

                    
#region Extract attack information
                    
ushort SpellID 000;
                    
uint Target 0;
                    if (
attack.AttackType == Attack.Magic)
                    {
                        if (!
attack.Decoded)
                        {
                            
#region GetSkillID
                            
SpellID Convert.ToUInt16(((long)attack.ToArray()[28] & 0xFF) | (((long)attack.ToArray()[29] & 0xFF) << 8));
                            
SpellID ^= (ushort)0x915d;
                            
SpellID ^= (ushort)attacker.UID;
                            
SpellID = (ushort)(SpellID << 0x3 SpellID >> 0xd);
                            
SpellID -= 0xeb42;
                            
#endregion
                            #region GetCoords
                            
= (ushort)((attack.ToArray()[20] & 0xFF) | ((attack.ToArray()[21] & 0xFF) << 8));
                            
= (ushort)(^ (uint)(attacker.UID 0xffff) ^ 0x2ed6);
                            
= (ushort)(((<< 1) | ((0x8000) >> 15)) & 0xffff);
                            
= (ushort)((0xffff0000) - 0xffff22ee);

                            
= (ushort)((attack.ToArray()[22] & 0xFF) | ((attack.ToArray()[23] & 0xFF) << 8));
                            
= (ushort)(^ (uint)(attacker.UID 0xffff) ^ 0xb99b);
                            
= (ushort)(((<< 5) | ((0xF800) >> 11)) & 0xffff);
                            
= (ushort)((0xffff0000) - 0xffff8922);
                            
#endregion
                            #region GetTarget
                            
Target = ((uint)attack.ToArray()[16] & 0xFF) | (((uint)attack.ToArray()[17] & 0xFF) << 8) | (((uint)attack.ToArray()[18] & 0xFF) << 16) | (((uint)attack.ToArray()[19] & 0xFF) << 24);
                            
Target = ((((Target 0xffffe000) >> 13) | ((Target 0x1fff) << 19)) ^ 0x5F2D2463 attacker.UID) - 0x746F4AE6;
                            
#endregion

                            
attack.X;
                            
attack.Y;
                            
attack.Damage SpellID;
                            
attack.Attacked Target;
                            
attack.Decoded true;
                        }
                        else
                        {
                            
attack.X;
                            
attack.Y;
                            
SpellID = (ushort)attack.Damage;
                            
Target attack.Attacked;
                        }
                    }
                    
#endregion

                    
if (!pass && attack.AttackType == Attack.Magic)
                    {
                        if (!(
doWep1Spell || doWep2Spell))
                        {
                            if (
SpellID == 11960 || SpellID == 1045 || SpellID == 1046 || SpellID == 11005 || SpellID == 11000 || SpellID == 1100 || SpellID == 1002 || SpellID == 11070 || SpellID == 12080 || SpellID == 10381 || SpellID == 1095 || SpellID == 1090 || SpellID == 12110// FB and SS
                            
{
                                
//do checks
                            
}
                            else
                            {
                                
int milliSeconds 1000 decrease;
                                if (
milliSeconds || milliSeconds 5000)
                                    
milliSeconds 0;
                                if (
Time32.Now attacker.AttackStamp.AddMilliseconds(milliSeconds))
                                    return;
                            }

                            
attacker.AttackStamp Time32.Now;
                        }
                    }
                    
#endregion
                    
if (attacker.ContainsFlag(Update.Flags.Ride) && attacker.Owner.Equipment.TryGetItem(18) == null)
                    {
                        if (
attack.AttackType != Attack.Magic)
                            
attacker.RemoveFlag(Update.Flags.Ride);
                        else
                            if (!(
SpellID == 7003 || SpellID == 7002))
                                
attacker.RemoveFlag(Update.Flags.Ride);
                    }
                    if (
attacker.ContainsFlag(Update.Flags.CastPray))
                        
attacker.RemoveFlag(Update.Flags.CastPray);
                    if (
attacker.ContainsFlag(Update.Flags.Praying))
                        
attacker.RemoveFlag(Update.Flags.Praying);

                    
#region Dash
                    
if (SpellID == 1051)
                    {

                        if (
Kernel.GetDistance(attack.Xattack.Yattacker.Xattacker.Y) > 4)
                        {
                            
attacker.Owner.Disconnect();
                            return;
                        }
                        
attacker.attack.Xattacker.attack.Y;
                        
ushort x attacker.Xattacker.Y;
                        
Game.Map.UpdateCoordonatesForAngle(ref xref y, (Enums.ConquerAngle)Target);
                        foreach (
Interfaces.IMapObject obj in attacker.Owner.Screen.Objects)
                        {
                            if (
obj == null)
                                continue;
                            if (
obj.== && obj.== && (obj.MapObjType == MapObjectType.Monster || obj.MapObjType == MapObjectType.Entity))
                            {
                                
Entity entity obj as Entity;
                                if (!
entity.Dead)
                                {
                                    
Target obj.UID;
                                    break;
                                }
                            }
                        }
                    }
                    
#endregion

                    #region CounterKill
                    
if (attack.AttackType == Attack.CounterKillSwitch)
                    {

                        if (
attacked != null)
                            if (
attacked.ContainsFlag(Update.Flags.Fly)) { attacker.AttackPacket null; return; }
                        if (
attacker != null)
                            if (
attacker.ContainsFlag(Update.Flags.Fly)) { attacker.AttackPacket null; return; }
                        if (
attacker.Owner.Spells.ContainsKey(6003))
                        {
                            if (!
attacker.CounterKillSwitch)
                            {
                                if (
Time32.Now >= attacker.CounterKillStamp.AddSeconds(30))
                                {
                                    
attacker.CounterKillStamp Time32.Now;
                                    
attacker.CounterKillSwitch true;
                                    
Attack m_attack = new Attack(true);
                                    
m_attack.Attacked attacker.UID;
                                    
m_attack.Attacker attacker.UID;
                                    
m_attack.AttackType Attack.CounterKillSwitch;
                                    
m_attack.Damage 1;
                                    
m_attack.attacker.X;
                                    
m_attack.attacker.Y;
                                    
m_attack.Send(attacker.Owner);
                                }
                            }
                            else
                            {
                                
attacker.CounterKillSwitch false;
                                
Attack m_attack = new Attack(true);
                                
m_attack.Attacked attacker.UID;
                                
m_attack.Attacker attacker.UID;
                                
m_attack.AttackType Attack.CounterKillSwitch;
                                
m_attack.Damage 0;
                                
m_attack.attacker.X;
                                
m_attack.attacker.Y;
                                
m_attack.Send(attacker.Owner);
                            }

                            
attacker.Owner.IncreaseSpellExperience(1006003);
                            
attacker.AttackPacket null;
                        }
                    }
                    
#endregion

                    #region Melee
                    
else if (attack.AttackType == Attack.Melee)
                    {
                        if (
attacker.Assassin() || attacker.IsBowEquipped || attacker.IsChaser1())
                        {
                            
attack.AttackType Attack.Ranged;
                            new 
Game.Attacking.Handle(attackattackerattacked);
                            return;
                        }
                        if (
attacker.Owner.Screen.TryGetValue(attack.Attackedout attacked))
                        {
                            if (
attacker.LeeLong())
                            {
                                
attacker.Owner.IncreaseProficiencyExperience(10617);
                            }
                            
#region Up - Down Sweep & Strike
                            
int rate 0;
                            if (
attacker.Owner.Spells.ContainsKey(10490)) rate 100 Database.SpellTable.GetSpell(10490attacker.Owner).Percent;
                            if (
Kernel.Rate(rate))
                            {
                                if (
attack.SpellID >= 12580 && attack.SpellID <= 12600 && attacker.EpicMonk())
                                {
                                    var 
spell Database.SpellTable.GetSpell(attack.SpellIDattacker.Owner);
                                    if (
spell != null)
                                    {
                                        
SpellUse suse = new SpellUse(true);

                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID attack.SpellID;
                                        
suse.SpellLevel spell.ID;
                                        
suse.attacker.X;
                                        
suse.attacker.Y;
                                        
Fan fan = new Fan(attacker.Xattacker.Yattacked.Xattacked.Yspell.Rangespell.Sector);

                                        foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                        {
                                            if (
_obj == null) continue;
                                            if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                            {
                                                
attacked _obj as Entity;
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= 7)
                                                {
                                                    if (
CanAttack(attackerattackednullattack.AttackType == Attack.Melee))
                                                    {
                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damages Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                        
damages = (damages 22) / 100;
                                                        
attack.Attacked attacked.UID;
                                                        
attack.Damage damages;
                                                        
suse.Effect1 attack.Effect1;
                                                        
suse.AddTarget(_objdamagesattack);
                                                        
ReceiveAttack(attackerattackedattackref damagesnull);
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.SendScreen(suse);
                                        
attacker.AttackPacket null;
                                        return;
                                    }
                                }
                            }
                            else if (
attacker.Owner.Spells.ContainsKey(10490) && attacker.Monk())
                            {
                                var 
spell Database.SpellTable.GetSpell(10490attacker.Owner);

                                if (
Kernel.Rate(spell.MonsterPower 55) && attacker.Owner.Spells.ContainsKey(12570) && attacker.EpicMonk())
                                {
                                    
spell Database.SpellTable.GetSpell(12570attacker.Owner);
                                    if (
CanUseSpell(spellattacker.Owner))
                                    {
                                        
PrepareSpell(spellattacker.Owner);
                                        
SpellUse suse2 = new SpellUse(true);
                                        
suse2.Attacker attacker.UID;
                                        
suse2.SpellID spell.ID;
                                        
suse2.SpellLevel spell.Level;
                                        if (
attacked != null)
                                        {
                                            
suse2.attacked.X;
                                            
suse2.attacked.Y;
                                        }
                                        else
                                        {
                                            
suse2.attackedsob.X;
                                            
suse2.attackedsob.Y;
                                        }
                                        
suse2.SpellEffect 1;
                                        foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                        {
                                            if (
_obj == null) continue;
                                            if (
_obj.MapObjType == MapObjectType.Monster)
                                            {
                                                
attacked _obj as Entity;
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                {
                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                        
damage = (damage 22) / 100;
                                                        
attack.Damage 0;
                                                        
ReceiveAttack(attackerattackedattackref damagespell);
                                                        
suse2.AddTarget(attackeddamageattack);
                                                    }
                                                }
                                            }
                                            else if (
_obj.MapObjType == MapObjectType.Entity)
                                            {
                                                
attacked _obj as Entity;
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                {
                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {

                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                        
damage = (damage 22) / 100;
                                                        
attack.Damage 0;
                                                        
ReceiveAttack(attackerattackedattackref damagespell);
                                                        
suse2.AddTarget(attackeddamageattack);
                                                    }
                                                }
                                            }
                                            else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                            {
                                                
attackedsob _obj as SobNpcSpawn;
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                {
                                                    if (
CanAttack(attackerattackedsobspell))
                                                    {
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
damage = (damage 22) / 100;
                                                        
attack.Damage 0;
                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                        
suse2.AddTarget(attackedsobdamageattack);
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.Owner.SendScreen(suse2true);
                                        
attacker.AttackPacket null;
                                        return;

                                    }
                                }
                                else
                                {
                                    if (
CanUseSpell(spellattacker.Owner))
                                    {
                                        
PrepareSpell(spellattacker.Owner);
                                        
TryTrip suse = new TryTrip(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
// if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
                                        
{
                                            if (
attackedsob != null)
                                            {
                                                if (
CanAttack(attackerattackedsobspell))
                                                {
                                                    
uint damage Calculate.Melee(attackerattackedsobref attack);
                                                    
damage = (damage 22) / 100;
                                                    
suse.Attacked attackedsob.UID;
                                                    
attack.Damage 0;
                                                    
suse.Damage damage;
                                                    
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                    
attacker.Owner.SendScreen(susetrue);
                                                }
                                            }
                                            else
                                            {
                                                if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                {
                                                    
uint damage Calculate.Melee(attackerattackedspellref attack);
                                                    
damage = (damage 22) / 100;
                                                    
suse.Attacked attacked.UID;
                                                    
suse.Damage damage;
                                                    
attack.Damage 0;
                                                    
ReceiveAttack(attackerattackedattackref damagespell);
                                                    
attacker.Owner.SendScreen(susetrue);
                                                }
                                            }
                                            
attacker.AttackPacket null; return;
                                        }
                                    }
                                }
                                
attacker.AttackPacket null;
                                return;
                            }
                            
#endregion
                            #region ScarofEarth
                            
if (attacker.Owner.Spells.ContainsKey(12670) && attacker.EpicWarrior())
                            {
                                var 
spell Database.SpellTable.GetSpell(12670attacker.Owner);
                                if (
spell != null)
                                {
                                    
int Rate spell.Percent;
                                    if (
attacked.EntityFlag == Game.EntityFlag.Entity)
                                    {
                                        
int diff attacked.BattlePower attacker.BattlePower;
                                        if (
diff 0diff 0;
                                        
Rate -= (byte)(diff 5);
                                        if (
Rate 0Rate 0;
                                    }
                                    if (
Kernel.Rate(Rate))
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID 12670;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
attacked.UID == attacker.UID) continue;
                                                    if (
Kernel.GetDistance(attacked.Xattacked.Yattacker.Xattacker.Y) <= 5)
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                            
damage = (uint)(damage 0.780);
                                                            
attack.Damage 0;
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamagenull);

                                                        }
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.Monster)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
attacked.UID == attacker.UID) continue;
                                                    if (
Kernel.GetDistance(attacked.Xattacked.Yattacker.Xattacker.Y) <= 5)
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                            
attack.Damage 0;
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamagenull);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.AttackPacket null;
                                            
attacker.Owner.SendScreen(susetrue);
                                            return;
                                        }
                                    }
                                }
                            }
                            
#endregion
                            #region EarthSweep
                            
if (attack.SpellID == 12220 || attack.SpellID == 12210)
                            {
                                
SpellUse suse = new SpellUse(true);
                                
suse.Attacker attacker.UID;
                                
suse.SpellID attack.SpellID;
                                
suse.SpellLevel 0;
                                
suse.attacker.X;
                                
suse.attacker.Y;
                                
Fan fan = new Fan(attacker.Xattacker.Yattacked.Xattacked.Y7180);
                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                {
                                    if (
_obj == null)
                                        continue;
                                    if (
_obj.MapObjType == MapObjectType.Monster ||
                                        
_obj.MapObjType == MapObjectType.Entity)
                                    {
                                        
attacked _obj as Entity;
                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= 7)
                                        {
                                            if (
CanAttack(attackerattackednullattack.AttackType == Attack.Melee))
                                            {
                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                
uint damage Game.Attacking.Calculate.Melee(attacker,
                                                    
attackedref attack);
                                                
attack.Attacked 0;
                                                
attack.Damage damage;
                                                
suse.Effect1 attack.Effect1;
                                                
ReceiveAttack(attackerattackedattackref damagenull);
                                                
suse.AddTarget(attackeddamageattack);
                                            }
                                        }
                                    }
                                }
                                
attacker.Owner.SendScreen(susetrue);
                                
attacker.AttackPacket null;
                                
attack null;
                                return;
                            }
                            
#endregion
                            #region EpicMonk
                            
if (attack.SpellID == 12580 || attack.SpellID == 12590 || attack.SpellID == 12600)
                            {
                                
Fan fan = new Fan(attacker.Xattacker.Yattacked.Xattacked.Y7240);
                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                {
                                    if (
_obj == null) continue;
                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                    {
                                        
attacked _obj as Entity;
                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= 7)
                                        {
                                            if (
CanAttack(attackerattackednullattack.AttackType == Attack.Melee))
                                            {
                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                var 
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                
damage = (uint)(damage 0.780);
                                                
attack.Attacked attacker.UID;
                                                
attack.Attacked attacked.UID;
                                                
attack.Damage damage;
                                                
ReceiveAttack(attackerattackedattackref damagenull);
                                            }
                                        }
                                    }
                                }
                                
attacker.AttackPacket null;
                                
attack null;
                                return;
                            }
                            
#endregion
                            #region Stomper(Melee)
                            #region Anger-Horror-Peace~of~Stomper(Windwalker-Stomper-Passive)
                            
var lastattacked attacked;
                            var 
spell5 Database.SpellTable.GetSpell(12980attacker.Owner);
                            if (
Kernel.Rate(spell5.Percent) && attacker.Owner.Spells.ContainsKey(12980) && attacker.IsStomper2())
                            {
                                
#region AngerofStomper
                                
{
                                    
SpellUse suse = new SpellUse(true);
                                    
suse.Attacker attacker.UID;
                                    
suse.SpellID spell5.ID;
                                    
suse.SpellLevel spell5.Level;
                                    
suse.lastattacked.X;
                                    
suse.lastattacked.Y;
                                    foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                    {
                                        if (
_obj == null)
                                            continue;
                                        
attacked _obj as Entity;
                                        if (
attacked == null) continue;
                                        if (
Kernel.GetDistance(attacked.Xattacked.Yattacker.Xattacker.Y) <= spell5.Range)
                                        {
                                            if (
_obj.MapObjType == MapObjectType.Entity)
                                            {
                                                if (!
CanAttack(attackerattackednullattack.AttackType == Attack.Melee)) continue;
                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                var 
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                
damage = (uint)(damage 1.100);
                                                
suse.Effect1 attack.Effect1;
                                                
attack.Damage 0;
                                                
ReceiveAttack(attackerattackedattackref damagespell5);
                                                
suse.AddTarget(attackeddamageattack);
                                            }
                                            else if (
_obj.MapObjType == MapObjectType.Monster)
                                            {
                                                if (!
CanAttack(attackerattackednullattack.AttackType == Attack.Melee)) continue;
                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                
damage = (uint)(damage 0.780);
                                                
attack.Damage 0;
                                                
ReceiveAttack(attackerattackedattackref damagespell5);
                                                
suse.AddTarget(attacked.UIDdamageattack);
                                            }
                                            else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                            {
                                                
attackedsob _obj as SobNpcSpawn;
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell5.Range)
                                                {
                                                    if (
CanAttack(attackerattackedsobspell5))
                                                    {
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
damage = (damage 22) / 100;
                                                        
attack.Damage 0;
                                                        
ReceiveAttack(attackerattackedsobattackdamagespell5);
                                                        
suse.AddTarget(attackedsobdamageattack);
                                                    }
                                                }
                                            }
                                        }

                                    }
                                    
attacker.AttackPacket null;
                                    
attacker.Owner.SendScreen(susetrue);

                                }
                                
#endregion
                                #region HorrorofStomper
                                
{
                                    var 
spell2 Database.SpellTable.GetSpell(12990attacker.Owner);
                                    if (!
attacker.Owner.Spells.ContainsKey(12990)) return;
                                    
attack.Damage 0;
                                    
SpellUse suse = new SpellUse(true);
                                    
suse.Attacker attacker.UID;
                                    
suse.SpellID spell2.ID;
                                    
suse.SpellLevel spell2.Level;
                                    
suse.lastattacked.X;
                                    
suse.lastattacked.Y;
                                    
attacker.AttackPacket null;
                                    
attacker.Owner.SendScreen(susetrue);
                                    
#region Flooritem
                                    
var map Kernel.Maps[attacker.MapID];
                                    
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
                                    
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                    while (
map.Npcs.ContainsKey(flooritem.UID))
                                        
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                    
flooritem.ItemID 1530;
                                    
flooritem.lastattacked.X;
                                    
flooritem.lastattacked.Y;
                                    
flooritem.Type FloorItem.Effect;
                                    
flooritem.mColor 14;
                                    
flooritem.OwnerUID attacker.UID;
                                    
flooritem.OwnerGuildUID attacker.GuildID;
                                    
flooritem.FlowerType 3;
                                    
flooritem.Unknown37 1;
                                    
flooritem.X2 attacker.X;
                                    
flooritem.MapObjType MapObjectType.FloorSpell;
                                    
flooritem.Y2 attacker.Y;
                                    
flooritem.Angle attacker.Facing;
                                    
flooritem.MapID map.ID;
                                    
flooritem.Attack attack;
                                    
flooritem.OnFloor Time32.Now;
                                    
flooritem.Owner attacker.Owner;
                                    
map.AddFloorItem(flooritem);
                                    
attacker.Owner.SendScreenSpawn(flooritemtrue);
                                    
#endregion
                                
}
                                
#endregion
                                #region PeaceofStomper
                                
{
                                    var 
spell3 Database.SpellTable.GetSpell(13000attacker.Owner);
                                    if (!
attacker.Owner.Spells.ContainsKey(13000)) return;
                                    
attack.Damage 0;
                                    
SpellUse suse = new SpellUse(true);
                                    
suse.Attacker attacker.UID;
                                    
suse.SpellLevel spell3.Level;
                                    
suse.SpellID spell3.ID;
                                    
suse.lastattacked.X;
                                    
suse.lastattacked.Y;
                                    
attacker.AttackPacket null;
                                    
attacker.Owner.SendScreen(susetrue);
                                    
#region Flooritem
                                    
var map Kernel.Maps[attacker.MapID];
                                    
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
                                    
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                    while (
map.Npcs.ContainsKey(flooritem.UID))
                                        
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                    
flooritem.ItemID 1540;
                                    
flooritem.lastattacked.X;
                                    
flooritem.lastattacked.Y;
                                    
flooritem.X2 attacker.X;
                                    
flooritem.Y2 attacker.Y;
                                    
flooritem.Type FloorItem.Effect;
                                    
flooritem.mColor 14;
                                    
flooritem.OwnerUID attacker.UID;
                                    
flooritem.OwnerGuildUID attacker.GuildID;
                                    
flooritem.FlowerType 3;
                                    
flooritem.Unknown37 1;
                                    
flooritem.MapID map.ID;
                                    
flooritem.MapObjType MapObjectType.FloorSpell;
                                    
flooritem.Attack attack;
                                    
flooritem.OnFloor Time32.Now;
                                    
flooritem.Owner attacker.Owner;
                                    
map.AddFloorItem(flooritem);
                                    
attacker.Owner.SendScreenSpawn(flooritemtrue);
                                    
#endregion
                                
}
                                
#endregion
                                
return;
                            }
                            
#endregion
                            
else if (attacker.IsStomper1())
                            {
                                
#region Sector-Circle-Rectangle(Windwalker-Stomper-Melee)
                                
if (attack.SpellID == 13040 || attack.SpellID == 13050)
                                {
                                    
#region Sector
                                    
if (attack.SpellID == 13040)
                                    {
                                        var 
spell Database.SpellTable.GetSpell(13040attacker.Owner);
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID attack.SpellID;
                                        
suse.attacker.X;
                                        
suse.attacker.Y;
                                        var 
angle Kernel.GetAngle(attacker.Xattacker.Yattacked.Xattacked.Y);
                                        
Map.UpdateCoordonatesForAngle(ref Xref Yangle);
                                        
Fan sector = new Fan(attacker.Xattacker.YXYspell.Rangespell.Sector);
                                        if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= 7)
                                        {
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj.MapObjType == MapObjectType.Entity || _obj.MapObjType == MapObjectType.Monster)
                                                {
                                                    if (
_obj == null)
                                                        continue;
                                                    
attacked _obj as Entity;
                                                    if (
attacked == null) continue;
                                                    if (!
CanAttack(attackerattackednullattack.AttackType == Attack.Melee)) continue;
                                                    if (
sector.IsInFan(attacked.Xattacked.Y))
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                            
attack.Damage 0;
                                                            
suse.Effect1 attack.Effect1;
                                                            
ReceiveAttack(attackerattackedattackref damagespell);
                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    
#endregion
                                    #region Circle
                                    
if (attack.SpellID == 13050)
                                    {
                                        var 
spell Database.SpellTable.GetSpell(13050attacker.Owner);
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID attack.SpellID;
                                        
suse.attacker.X;
                                        
suse.attacker.Y;
                                        foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                        {
                                            if (
_obj.MapObjType == MapObjectType.Entity || _obj.MapObjType == MapObjectType.Monster)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                
attacked _obj as Entity;
                                                if (
attacked == null) continue;
                                                if (!
CanAttack(attackerattackednullattack.AttackType == Attack.Melee)) continue;
                                                if (
Kernel.GetDistance(attacked.Xattacked.Yattacker.Xattacker.Y) > 5) continue;
                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                
attack.Damage 0;
                                                
ReceiveAttack(attackerattackedattackref damagespell);
                                                
suse.AddTarget(attackeddamageattack);
                                            }
                                        }
                                        
attacker.Owner.SendScreen(susetrue);
                                        return;
                                    }
                                    
#endregion

                                
}
                                
#endregion

                            
}
                            
#endregion

                            
CheckForExtraWeaponPowers(attacker.Ownerattacked);
                            if (!
CanAttack(attackerattackednullattack.AttackType == Attack.Melee)) return;
                            
pass false;
                            if (
attacker.OnFatalStrike())
                            {
                                if (
attacked.EntityFlag == EntityFlag.Monster)
                                {
                                    
pass true;
                                }
                            }
                            
ushort range attacker.AttackRange;
                            if (
attacker.Transformed)
                                
range = (ushort)attacker.TransformationAttackRange;
                            if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= range || pass)
                            {
                                
attack.Effect1 Attack.AttackEffects1.None;
                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                
damage = (uint)(damage 0.780);
                                
attack.Damage damage;
                                if (
attacker.OnFatalStrike())
                                {
                                    if (
attacked.EntityFlag == EntityFlag.Monster)
                                    {
                                        var 
weaps attacker.Owner.Weapons;
                                        
bool can false;
                                        if (
weaps.Item1 != null)
                                            if (
weaps.Item1 != null) if (weaps.Item1.ID 1000 == 601 || weaps.Item1.ID 1000 == 616can true; if (weaps.Item2 != null) if (weaps.Item2.ID 1000 == 601 || weaps.Item2.ID 1000 == 616can true;
                                        
can true;
                                        if (
weaps.Item2 != null)
                                            if (
weaps.Item1 != null) if (weaps.Item1.ID 1000 == 601 || weaps.Item1.ID 1000 == 616can true; if (weaps.Item2 != null) if (weaps.Item2.ID 1000 == 601 || weaps.Item2.ID 1000 == 616can true;
                                        
can true;
                                        if (!
can)
                                            return;
                                        
ushort x attacked.X;
                                        
ushort y attacked.Y;
                                        
Map.UpdateCoordonatesForAngle(ref xref yKernel.GetAngle(attacked.Xattacked.Yattacker.Xattacker.Y));
                                        
attacker.Shift(xy);
                                        
attack.x;
                                        
attack.y;
                                        
attack.Damage damage;

                                        
attack.AttackType Attack.FatalStrike;
                                    }
                                }
                                var 
weapons attacker.Owner.Weapons;
                                if (
weapons.Item1 != null)
                                {
                                    
ConquerItem rightweapon weapons.Item1;
                                    
ushort wep1subyte = (ushort)(rightweapon.ID 1000), wep2subyte 0;
                                    
bool wep1bs falsewep2bs false;
                                    if (
wep1subyte == 421 || wep1subyte == 620)
                                    {
                                        
wep1bs true;
                                        
wep1subyte 420;
                                    }
                                    
ushort wep1spellid 0wep2spellid 0;
                                    
Database.SpellInformation wep1spell nullwep2spell null;
                                    if (
wep1subyte == 622)
                                    {
                                        if (
attacker.WrathoftheEmperor == true)
                                        {
                                            if (
attacker.WrathoftheEmperorStamp <= DateTime.Now.AddMilliseconds(1500))
                                            {
                                                
wep1spellid 12570;

                                            }
                                            
attacker.WrathoftheEmperor false;
                                        }
                                    }

                                    if (
Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
                                    {
                                        var 
weaponskill Database.SpellTable.WeaponSpells[wep1subyte];
                                        for (
int i 0weaponskill.Counti++)
                                        {
                                            if (!
doWep1Spell)
                                            {
                                                
wep1spellid weaponskill[i];
                                                if (
attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
                                                {
                                                    
wep1spell Database.SpellTable.SpellInformations[wep1spellid][attacker.Owner.Spells[wep1spellid].Level];
                                                    
doWep1Spell Kernel.Rate(wep1spell.Percent);
                                                    if (
attacked.EntityFlag == EntityFlag.Entity && wep1spellid == 10490)
                                                        
doWep1Spell Kernel.Rate(5);
                                                }
                                            }
                                        }
                                    }
                                    if (!
doWep1Spell)
                                    {
                                        if (
weapons.Item2 != null)
                                        {
                                            
ConquerItem leftweapon weapons.Item2;
                                            
wep2subyte = (ushort)(leftweapon.ID 1000);
                                            if (
wep2subyte == 421 || wep2subyte == 620)
                                            {
                                                
wep2bs true;
                                                
wep2subyte 420;
                                            }
                                            if (
Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
                                            {
                                                var 
weaponskill2 Database.SpellTable.WeaponSpells[wep2subyte];
                                                for (
int i 0weaponskill2.Counti++)
                                                {
                                                    if (!
doWep2Spell)
                                                    {
                                                        
wep2spellid weaponskill2[i];
                                                        if (
attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
                                                        {
                                                            
wep2spell Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level];
                                                            
doWep2Spell Kernel.Rate(wep2spell.Percent);
                                                            if (
attacked.EntityFlag == EntityFlag.Entity && wep2spellid == 10490)
                                                                
doWep2Spell Kernel.Rate(5);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    if (!
attacker.Transformed)
                                    {
                                        if (
doWep1Spell)
                                        {
                                            
attack.AttackType Attack.Magic;
                                            
attack.Decoded true;
                                            
attack.weaponspell true;
                                            
attack.attacked.X;
                                            
attack.attacked.Y;
                                            
attack.Attacked attacked.UID;
                                            
attack.Damage wep1spell.ID;
                                            goto 
restart;
                                        }
                                        if (
doWep2Spell)
                                        {
                                            
attack.AttackType Attack.Magic;
                                            
attack.Decoded true;
                                            
attack.weaponspell true;
                                            
attack.attacked.X;
                                            
attack.attacked.Y;
                                            
attack.Attacked attacked.UID;
                                            
attack.Damage wep2spell.ID;
                                            goto 
restart;
                                        }
                                        if (
wep1bs)
                                            
wep1subyte++;
                                        if (
attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag != EntityFlag.Entity)
                                            if (
damage attacked.Hitpoints)
                                            {
                                                
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damageattacked.Hitpoints), wep1subyte);
                                                if (
wep2subyte != 0)
                                                {
                                                    if (
wep2bs)
                                                        
wep2subyte++;
                                                    
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damageattacked.Hitpoints), wep2subyte);
                                                }
                                            }
                                            else
                                            {
                                                
attacker.Owner.IncreaseProficiencyExperience(damagewep1subyte);
                                                if (
wep2subyte != 0)
                                                {
                                                    if (
wep2bs)
                                                        
wep2subyte++;
                                                    
attacker.Owner.IncreaseProficiencyExperience(damagewep2subyte);
                                                }
                                            }
                                    }
                                }
                                else
                                {
                                    if (!
attacker.Transformed)
                                    {
                                        if (
attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag != EntityFlag.Entity)
                                            if (
damage attacked.Hitpoints)
                                            {
                                                
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damageattacked.Hitpoints), 0);
                                            }
                                            else
                                            {
                                                
attacker.Owner.IncreaseProficiencyExperience(damage0);
                                            }
                                    }
                                }
                                
ReceiveAttack(attackerattackedattackref damagenull);
                                
attack.AttackType Attack.Melee;
                            }
                            else
                            {
                                
attacker.AttackPacket null;
                            }
                        }
                        else if (
attacker.Owner.Screen.TryGetSob(attack.Attackedout attackedsob))
                        {
                            
CheckForExtraWeaponPowers(attacker.Ownernull);
                            if (
CanAttack(attackerattackedsobnull))
                            {
                                
ushort range attacker.AttackRange;
                                if (
attacker.Transformed)
                                    
range = (ushort)attacker.TransformationAttackRange;
                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= range)
                                {
                                    
attack.Effect1 Attack.AttackEffects1.None;
                                    
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);

                                    var 
weapons attacker.Owner.Weapons;
                                    if (
weapons.Item1 != null)
                                    {
                                        
ConquerItem rightweapon weapons.Item1;
                                        
ushort wep1subyte = (ushort)(rightweapon.ID 1000), wep2subyte 0;
                                        
bool wep1bs falsewep2bs false;
                                        if (
wep1subyte == 421 || wep1subyte == 620)
                                        {
                                            
wep1bs true;
                                            
wep1subyte 420;
                                        }

                                        
ushort wep1spellid 0wep2spellid 0;
                                        
Database.SpellInformation wep1spell nullwep2spell null;
                                        if (
Database.SpellTable.WeaponSpells.ContainsKey(wep1subyte))
                                        {
                                            var 
wep1 Database.SpellTable.WeaponSpells[wep1subyte];
                                            for (
int i 0wep1.Counti++)
                                            {
                                                if (!
doWep1Spell)
                                                {
                                                    
wep1spellid wep1[i];
                                                    if (
attacker.Owner.Spells.ContainsKey(wep1spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep1spellid))
                                                    {
                                                        
wep1spell Database.SpellTable.SpellInformations[wep1spellid][attacker.Owner.Spells[wep1spellid].Level];
                                                        
doWep1Spell Kernel.Rate(wep1spell.Percent);
                                                    }
                                                }
                                            }
                                        }
                                        if (!
doWep1Spell)
                                        {
                                            if (
weapons.Item2 != null)
                                            {
                                                
ConquerItem leftweapon weapons.Item2;
                                                
wep2subyte = (ushort)(leftweapon.ID 1000);
                                                if (
wep2subyte == 421 || wep2subyte == 620)
                                                {
                                                    
wep2bs true;
                                                    
wep2subyte 420;
                                                }
                                                if (
Database.SpellTable.WeaponSpells.ContainsKey(wep2subyte))
                                                {
                                                    var 
wep2 Database.SpellTable.WeaponSpells[wep2subyte];
                                                    for (
int i 0wep2.Counti++)
                                                    {
                                                        
wep2spellid wep2[i];
                                                        if (
attacker.Owner.Spells.ContainsKey(wep2spellid) && Database.SpellTable.SpellInformations.ContainsKey(wep2spellid))
                                                        {
                                                            
wep2spell Database.SpellTable.SpellInformations[wep2spellid][attacker.Owner.Spells[wep2spellid].Level];
                                                            
doWep2Spell Kernel.Rate(wep2spell.Percent);
                                                        }
                                                    }
                                                }
                                            }
                                        }

                                        if (!
attacker.Transformed)
                                        {
                                            if (
doWep1Spell)
                                            {
                                                
attack.AttackType Attack.Magic;
                                                
attack.Decoded true;
                                                
attack.weaponspell true;
                                                
attack.attackedsob.X;
                                                
attack.attackedsob.Y;
                                                
attack.Attacked attackedsob.UID;
                                                
attack.Damage wep1spell.ID;
                                                goto 
restart;
                                            }
                                            if (
doWep2Spell)
                                            {
                                                
attack.AttackType Attack.Magic;
                                                
attack.Decoded true;
                                                
attack.weaponspell true;
                                                
attack.attackedsob.X;
                                                
attack.attackedsob.Y;
                                                
attack.Attacked attackedsob.UID;
                                                
attack.Damage wep2spell.ID;
                                                goto 
restart;
                                            }
                                            if (
attacker.MapID == 1039)
                                            {
                                                if (
wep1bs)
                                                    
wep1subyte++;
                                                if (
attacker.EntityFlag == EntityFlag.Entity)
                                                    if (
damage attackedsob.Hitpoints)
                                                    {
                                                        
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damageattackedsob.Hitpoints), wep1subyte);
                                                        if (
wep2subyte != 0)
                                                        {
                                                            if (
wep2bs)
                                                                
wep2subyte++;
                                                            
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damageattackedsob.Hitpoints), wep2subyte);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        
attacker.Owner.IncreaseProficiencyExperience(damagewep1subyte);
                                                        if (
wep2subyte != 0)
                                                        {
                                                            if (
wep2bs)
                                                                
wep2subyte++;
                                                            
attacker.Owner.IncreaseProficiencyExperience(damagewep2subyte);
                                                        }
                                                    }
                                            }
                                        }
                                    }
                                    
attack.Damage damage;
                                    
ReceiveAttack(attackerattackedsobattackdamagenull);
                                }
                                else
                                {
                                    
attacker.AttackPacket null;
                                }
                            }
                        }
                        else
                        {
                            
attacker.AttackPacket null;
                        }
                    }
                    
#endregion

                    #region Ranged
                    
else if (attack.AttackType == Attack.Ranged)
                    {

                        if (
attacker.Owner.Screen.TryGetValue(attack.Attackedout attacked))
                        {
                            
CheckForExtraWeaponPowers(attacker.Ownerattacked);
                            if (!
CanAttack(attackerattackednullfalse))
                                return;
                            var 
weapons attacker.Owner.Weapons;
                            if (
weapons.Item1 == null) return;
                            if ((
weapons.Item1.ID 1000 != 500 && weapons.Item1.ID 1000 != 613) && !attacker.IsChaser1())
                                return;

                            if (
weapons.Item1.ID 1000 == 500)
                                if (
weapons.Item2 != null && !attacker.IsChaser1())
                                    if (!
PacketHandler.IsArrow(weapons.Item2.ID))
                                        return;
                            
#region Kinetic Spark
                            
if (attacker.ContainsFlag3((ulong)Update.Flags3.KineticSpark))
                            {
                                var 
spell Database.SpellTable.GetSpell(11590attacker.Owner);
                                if (
spell != null)
                                {
                                    
spell.CanKill true;
                                    if (
Kernel.Rate(spell.Percent))
                                    {
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.attacker.X;
                                        
suse.attacker.Y;
                                        
IMapObject lastAttacked attacker;
                                        
uint p 0;
                                        if (
Handle.CanAttack(attackerattackedspellfalse))
                                        {
                                            
lastAttacked attacked;
                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                            
damage = (uint)((damage) / 1.50);
                                            
suse.Effect1 attack.Effect1;
                                            if (
attacker.SpiritFocus)
                                            {
                                                
damage = (uint)(damage attacker.SpiritFocusPercent);
                                                
attacker.SpiritFocus false;
                                            }
                                            
damage damage damage * (+= 20) / 100;
                                            
Handle.ReceiveAttack(attackerattackedattackref damagespell);
                                            
suse.AddTarget(attackeddamageattack);
                                        }
                                        foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                        {
                                            if (
_obj == null) continue;
                                            if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                            {
                                                if (
_obj.UID == attacked.UID) continue;
                                                var 
attacked1 _obj as Entity;
                                                if (
Kernel.GetDistance(lastAttacked.XlastAttacked.Yattacked1.Xattacked1.Y) <= 5)
                                                {
                                                    if (
Handle.CanAttack(attackerattacked1spellfalse))
                                                    {
                                                        
lastAttacked attacked1;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattacked1spellref attack);
                                                        
suse.Effect1 attack.Effect1;
                                                        if (
attacker.SpiritFocus)
                                                        {
                                                            
damage = (uint)(damage attacker.SpiritFocusPercent);
                                                            
attacker.SpiritFocus false;
                                                        }
                                                        
damage damage damage * (+= 20) / 100;
                                                        if (
damage == 0) break;
                                                        
ReceiveAttack(attackerattacked1attackref damagespell);
                                                        
suse.AddTarget(attacked1damageattack);
                                                    }
                                                }
                                            }
                                            else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                            {
                                                
attackedsob _obj as SobNpcSpawn;
                                                if (
Kernel.GetDistance(lastAttacked.XlastAttacked.Yattackedsob.Xattackedsob.Y) <= 5)
                                                {
                                                    if (
Handle.CanAttack(attackerattackedsobspell))
                                                    {
                                                        
lastAttacked attackedsob;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
suse.Effect1 attack.Effect1;
                                                        if (
attacker.SpiritFocus)
                                                        {
                                                            
damage = (uint)(damage attacker.SpiritFocusPercent);
                                                            
attacker.SpiritFocus false;
                                                        }
                                                        
damage damage damage * (+= 20) / 100;
                                                        if (
damage == 0) break;
                                                        
Handle.ReceiveAttack(attackerattackedsobattackdamagespell);
                                                        
suse.AddTarget(attackedsobdamageattack);
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.Owner.SendScreen(susetrue);
                                        return;
                                    }
                                }
                            }
                            
#endregion
                            #region ShadowofChaser
                            
if (attacker.ContainsFlag4(Update.Flags4.ShadowofChaser) && attacker.IsChaser2())
                            {
                                var 
spell Database.SpellTable.GetSpell(13090attacker.Owner);
                                if (
spell != null)
                                {
                                    
spell.CanKill true;
                                    if (
Kernel.Rate(spell.Percent))
                                    {
                                        
ShadowofChaser(attackerattackedattack1);
                                        return;
                                    }
                                }
                            }
                            
#endregion

                            
if (Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= Constants.pScreenDistance)
                            {
                                
attack.Effect1 Attack.AttackEffects1.None;
                                
uint damage 0;
                                if (!
attacker.Assassin() && !attacker.IsChaser1())
                                    
damage Game.Attacking.Calculate.Ranged(attackerattackedref attack) * 300;
                                else
                                    
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                
damage damage - (uint)(damage .50);
                                
attack.Damage damage;
                                if (
attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag != EntityFlag.Entity)
                                    if (
damage attacked.Hitpoints)
                                    {
                                        
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damageattacked.Hitpoints), (ushort)(weapons.Item1.ID 1000));
                                    }
                                    else
                                    {
                                        
attacker.Owner.IncreaseProficiencyExperience(damage, (ushort)(weapons.Item1.ID 1000));
                                    }
                                
ReceiveAttack(attackerattackedattackref damagenull);
                            }
                        }
                        else if (
attacker.Owner.Screen.TryGetSob(attack.Attackedout attackedsob))
                        {
                            if (
CanAttack(attackerattackedsobnull))
                            {

                                var 
weapons attacker.Owner.Weapons;
                                if (
weapons.Item1 == null) return;
                                if (
weapons.Item1.ID 1000 != 500 && weapons.Item1.ID 1000 != 613) return;

                                if (
attacker.MapID != 1039)
                                {
                                    if (
weapons.Item1.ID 1000 == 500)
                                    {
                                        if (
weapons.Item2 == null)
                                        {
                                            
attacker.SendSysMesage("please make sure you equipment an arrow");
                                            return;
                                        }
                                        else
                                        {

                                            if (!
PacketHandler.IsArrow(weapons.Item2.ID))
                                            {
                                                
attacker.SendSysMesage("please make sure you equipment an arrow");
                                                return;
                                            }
                                        }
                                    }
                                }
                                
#region Kinetic Spark
                                
if (attacker.ContainsFlag3((ulong)Update.Flags3.KineticSpark))
                                {
                                    var 
spell Database.SpellTable.GetSpell(11590attacker.Owner);
                                    if (
spell != null)
                                    {
                                        
spell.CanKill true;
                                        if (
Kernel.Rate(spell.Percent))
                                        {
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.attacker.X;
                                            
suse.attacker.Y;

                                            
IMapObject lastAttacked attacker;
                                            
uint p 0;
                                            if (
Handle.CanAttack(attackerattackedsobspell))
                                            {
                                                
lastAttacked attackedsob;
                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                
damage = (uint)((damage) / 1);
                                                
suse.Effect1 attack.Effect1;
                                                if (
attacker.SpiritFocus)
                                                {
                                                    
damage = (uint)(damage attacker.SpiritFocusPercent);
                                                    
attacker.SpiritFocus false;
                                                }
                                                
damage damage damage * (+= 20) / 100;
                                                
Handle.ReceiveAttack(attackerattackedsobattackdamagespell);
                                                
suse.AddTarget(attackedsobdamageattack);
                                            }
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null) continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    var 
attacked1 _obj as Entity;
                                                    if (
Kernel.GetDistance(lastAttacked.XlastAttacked.Yattacked1.Xattacked1.Y) <= 5)
                                                    {
                                                        if (
Handle.CanAttack(attackerattacked1spellfalse))
                                                        {
                                                            
lastAttacked attacked1;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattacked1spellref attack);
                                                            
suse.Effect1 attack.Effect1;
                                                            if (
attacker.SpiritFocus)
                                                            {
                                                                
damage = (uint)(damage attacker.SpiritFocusPercent);
                                                                
attacker.SpiritFocus false;
                                                            }
                                                            
damage damage damage * (+= 20) / 100;
                                                            if (
damage == 0) break;
                                                            
ReceiveAttack(attackerattacked1attackref damagespell);
                                                            
suse.AddTarget(attacked1damageattack);
                                                        }
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    if (
_obj.UID == Target) continue;
                                                    var 
attackedsob1 _obj as SobNpcSpawn;
                                                    if (
Kernel.GetDistance(lastAttacked.XlastAttacked.Yattackedsob1.Xattackedsob1.Y) <= 5)
                                                    {
                                                        if (
Handle.CanAttack(attackerattackedsob1spell))
                                                        {
                                                            
lastAttacked attackedsob1;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedsob1ref attack);
                                                            
suse.Effect1 attack.Effect1;
                                                            if (
attacker.SpiritFocus)
                                                            {
                                                                
damage = (uint)(damage attacker.SpiritFocusPercent);
                                                                
attacker.SpiritFocus false;
                                                            }
                                                            
damage damage damage * (+= 20) / 100;
                                                            if (
damage == 0) break;
                                                            
Handle.ReceiveAttack(attackerattackedsob1attackdamagespell);
                                                            
suse.AddTarget(attackedsob1damageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                            return;
                                        }
                                    }
                                }
                                
#endregion
                                
if (Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= Constants.pScreenDistance)
                                {
                                    
attack.Effect1 Attack.AttackEffects1.None;
                                    
uint damage 0;
                                    if (!
attacker.Assassin() && !attacker.IsChaser1())
                                        
damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack) / 2;
                                    else
                                        
damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack) / 2;
                                    
attack.Damage damage;
                                    
ReceiveAttack(attackerattackedsobattackdamagenull);
                                    if (
damage attackedsob.Hitpoints)
                                    {
                                        
attacker.Owner.IncreaseProficiencyExperience(Math.Min(damageattackedsob.Hitpoints), (ushort)(weapons.Item1.ID 1000));
                                    }
                                    else
                                    {
                                        
attacker.Owner.IncreaseProficiencyExperience(damage, (ushort)(weapons.Item1.ID 1000));
                                    }
                                }
                            }
                        }
                        else
                        {
                            
attacker.AttackPacket null;
                        }
                    }
                    
#endregion

                    #region Magic
                    
else if (attack.AttackType == Attack.Magic)
                    {
                        
CheckForExtraWeaponPowers(attacker.Ownerattacked);
                        
uint Experience 100;
                        
bool shuriken false;
                        
ushort spellID SpellID;
                        if (
SpellID >= 3090 && SpellID <= 3306)
                            
spellID 3090;
                        if (
spellID == 6012)
                            
shuriken true;



                        if (
attacker == null)
                            return;
                        if (
attacker.Owner == null)
                        {
                            
attacker.AttackPacket null;
                            return;
                        }
                        if (
attacker.Owner.Spells == null)
                        {
                            
attacker.Owner.Spells = new SafeDictionary<ushortInterfaces.ISkill>();
                            
attacker.AttackPacket null;
                            return;
                        }

                        if (
attacker.Owner.Account.State == AccountTable.AccountState.ProjectManager)
                        {
                            
attacker.Owner.Send("Spell ID: " spellID);
                        }

                        if (
attacker.Owner.Spells[spellID] == null && spellID != 6012)
                        {
                            
attacker.AttackPacket null;
                            return;
                        }

                        
Database.SpellInformation spell null;
                        if (
shuriken)
                            
spell Database.SpellTable.SpellInformations[6010][0];
                        else
                        {
                            
byte choselevel 0;
                            if (
spellID == SpellID)
                                
choselevel attacker.Owner.Spells[spellID].Level;
                            if (
Database.SpellTable.SpellInformations[SpellID] != null && !Database.SpellTable.SpellInformations[SpellID].ContainsKey(choselevel))
                                
choselevel = (byte)(Database.SpellTable.SpellInformations[SpellID].Count 1);

                            
spell Database.SpellTable.SpellInformations[SpellID][choselevel];
                        }
                        if (
spell == null)
                        {
                            
attacker.AttackPacket null;
                            return;
                        }
                        
attacked null;
                        
attackedsob null;
                        if (
attacker.Owner.Screen.TryGetValue(Targetout attacked) || attacker.Owner.Screen.TryGetSob(Targetout attackedsob) || Target == attacker.UID || spell.Sort != 1)
                        {
                            if (
Target == attacker.UID)
                                
attacked attacker;
                            if (
attacked != null)
                            {
                                if (
attacked.Dead && spell.Sort != Database.SpellSort.Revive && spell.ID != 10405 && spell.ID != 10425)
                                {
                                    
attacker.AttackPacket null;
                                    return;
                                }
                            }
                            if (
Target >= 400000 && Target <= 600000 || Target >= 800000)
                            {
                                if (
attacked == null && attackedsob == null)
                                    return;
                            }
                            else if (
Target != && attacked == null && attackedsob == null && attackedItem == null)
                                return;
                            if (
attacked != null)
                            {
                                if (
attacked.EntityFlag == EntityFlag.Monster)
                                {
                                    if (
spell.CanKill)
                                    {
                                        if (
attacked.MonsterInfo.InSight == 0)
                                        {
                                            
attacked.MonsterInfo.InSight attacker.UID;
                                        }
                                    }
                                }
                            }
                            if (!
attacker.Owner.Spells.ContainsKey(spellID))
                            {
                                if (
spellID != 6012)
                                    return;
                            }
                            var 
weapons attacker.Owner.Weapons;
                            if (
spell != null)
                            {
                                if (
spell.OnlyWithThisWeaponSubtype.Count != 0)
                                {
                                    
uint firstwepsubtypesecondwepsubtype;
                                    if (
weapons.Item1 != null)
                                    {
                                        
firstwepsubtype weapons.Item1.ID 1000;
                                        if (
firstwepsubtype == 421firstwepsubtype 420;
                                        if (
weapons.Item2 != null)
                                        {
                                            
secondwepsubtype weapons.Item2.ID 1000;
                                            if (!
spell.OnlyWithThisWeaponSubtype.Contains((ushort)firstwepsubtype))
                                            {
                                                if (!
spell.OnlyWithThisWeaponSubtype.Contains((ushort)secondwepsubtype) && (spell.ID != 1046 && secondwepsubtype != 614 && firstwepsubtype != 614/*To Fix The Bug With ScentSword*/))
                                                {
                                                    
attacker.AttackPacket null;
                                                    return;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (!
spell.OnlyWithThisWeaponSubtype.Contains((ushort)firstwepsubtype))
                                            {
                                                
attacker.AttackPacket null;
                                                return;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        
attacker.AttackPacket null;
                                        return;
                                    }
                                }
                            }


                            
Interfaces.ISkill client_Spell;
                            if (!
attacker.Owner.Spells.TryGetValue(spell.IDout client_Spell))
                                if (!
attacker.Owner.Spells.TryGetValue(spellIDout client_Spell))
                                    return;

                            
#region Allowed Skills
                            
if (!attacker.Owner.Fake)
                            {
                                var 
xspell GetWeaponSpell(spell);
                                
//  var xspell = Database.SpellTable.WeaponSpells.Values.Where(p => p.Contains(spell.ID)).FirstOrDefault();
                                
if (xspell != null)
                                {
                                    if (!
attack.weaponspell && spell.Sort == SpellSort.SingleWeaponSkill)
                                    {
                                        
attacker.AttackPacket null;
                                        return;
                                    }
                                }

                                if (
attacker.Owner.LobbyGroup != null)
                                {
                                    if (
attacker.Owner.LobbyGroup.MatchType == Lobby.MatchType.FBSS)
                                    {
                                        if (
spellID != 1045 && spellID != 1046 && spellID != 11005)
                                        {
                                            
attacker.AttackPacket null;
                                            return;
                                        }
                                    }
                                }

                                if (
spellID == 1045 || spellID == 1046)
                                {
                                    if (
attack.Attacked != 0)
                                    {
                                        
attacker.AttackPacket null;
                                        return;
                                    }
                                }
                            }
                            
#endregion

                            
switch (spellID)
                            {
                                
#region Single magic damage spells
                                
case 11030:
                                case 
1000:
                                case 
1001:
                                case 
1002:
                                case 
1150:
                                case 
1160:
                                case 
1180:
                                case 
1320:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (
spell.ID == 10310)
                                            {
                                                if (
Time32.Now attacker.EagleEyeStamp.AddSeconds(20))
                                                    return;
                                                
attacker.EagleEyeStamp Time32.Now;
                                            }
                                            if (
attacked != null)
                                            {
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                                {

                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;

                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                        
damage = (uint)(damage 1.3);
                                                        if (
spell.ID == 11030)
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                        }
                                                        
suse.Effect1 attack.Effect1;

                                                        
suse.Effect1 attack.Effect1;

                                                        
ReceiveAttack(attackerattackedattackref damagespell);
                                                        if (
Time32.Now >= attacker.SpellStamp.AddMilliseconds(1900))
                                                        {
                                                            if (
spell.ID == 1002)
                                                            {
                                                                if (
attacked.EntityFlag == EntityFlag.Entity)
                                                                    
attacked.Owner.BreakTouch(attacker.Owner);

                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                                
damage = (uint)(damage 1.3);

                                                            }
                                                        }
                                                        
suse.AddTarget(attackeddamageattack);
                                                        
attacker.Owner.Player.IsEagleEyeShooted true;

                                                        if (
attacked.EntityFlag == EntityFlag.Entity)
                                                            
attacked.Owner.SendScreen(susetrue);
                                                        else
                                                            
attacked.MonsterInfo.SendScreen(suse);

                                                        var 
attackd attacked as Entity;
                                                        if (
Kernel.BlackSpoted.ContainsKey(attackd.UID) && spell.ID == 11030)
                                                        {
                                                            
attacker.Owner.Player.IsEagleEyeShooted false;
                                                            if (
attacker.Owner.Spells.ContainsKey(11130))
                                                            {
                                                                var 
attacker.Owner.Spells[11130];
                                                                var 
sspell Database.SpellTable.SpellInformations[s.ID][s.Level];
                                                                if (
spell != null)
                                                                {
                                                                    
attacker.EagleEyeStamp Time32.Now;
                                                                    
attacker.Owner.Player.IsEagleEyeShooted false;
                                                                    
SpellUse ssuse = new SpellUse(true);
                                                                    
ssuse.Attacker attacker.UID;
                                                                    
ssuse.SpellID sspell.ID;
                                                                    
ssuse.SpellLevel sspell.Level;
                                                                    
ssuse.AddTarget(attacker.Owner.Player, new SpellUse.DamageClass().Damage 11030attack);
                                                                    if (
attacker.EntityFlag == EntityFlag.Entity)
                                                                    {
                                                                        
attacker.Owner.SendScreen(ssusetrue);
                                                                    }

                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    
attacker.AttackPacket null;
                                                }
                                            }
                                            else
                                            {
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Distance)
                                                {
                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;

                                                    if (
CanAttack(attackerattackedsobspell))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Magic(attackerattackedsobspellref attack);
                                                        
suse.Effect1 attack.Effect1;

                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                        
suse.AddTarget(attackedsobdamageattack);

                                                        
attacker.Owner.SendScreen(susetrue);
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Single heal/meditation spells
                                
case 1190:
                                case 
1195:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;

                                            
uint damage spell.Power;
                                            if (
spell.ID == 1190)
                                            {
                                                
Experience damage Math.Min(damageattacker.MaxHitpoints attacker.Hitpoints);
                                                
attacker.Hitpoints += damage;
                                            }
                                            else
                                            {
                                                
Experience damage Math.Min(damage, (uint)(attacker.MaxMana attacker.Mana));
                                                
attacker.Mana += (ushort)damage;
                                            }

                                            
suse.AddTarget(attackerspell.Powerattack);

                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Multi heal spells
                                
case 1005:
                                case 
1055:
                                case 
1170:
                                case 
1175:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            if (
attackedsob != null)
                                            {
                                                if (
attacker.MapID == 1038)
                                                    break;
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Distance)
                                                {
                                                    
PrepareSpell(spellattacker.Owner);

                                                    
uint damage spell.Power;
                                                    
damage Math.Min(damageattackedsob.MaxHitpoints attackedsob.Hitpoints);
                                                    
attackedsob.Hitpoints += damage;
                                                    
Experience += damage;
                                                    
suse.AddTarget(attackedsobdamageattack);

                                                    
attacker.Owner.SendScreen(susetrue);
                                                }
                                            }
                                            else
                                            {
                                                if (
spell.Multi)
                                                {
                                                    if (
attacker.Owner.Team != null)
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        foreach (
Client.GameState teammate in attacker.Owner.Team.Teammates)
                                                        {
                                                            if (
Kernel.GetDistance(attacker.Xattacker.Yteammate.Player.Xteammate.Player.Y) <= spell.Distance)
                                                            {
                                                                
uint damage spell.Power;
                                                                
damage Math.Min(damageteammate.Player.MaxHitpoints teammate.Player.Hitpoints);
                                                                
teammate.Player.Hitpoints += damage;
                                                                
Experience += damage;
                                                                
suse.AddTarget(teammate.Playerdamageattack);

                                                                if (
spell.NextSpellID != 0)
                                                                {
                                                                    
attack.Damage spell.NextSpellID;
                                                                    
attacker.AttackPacket attack;
                                                                }
                                                                else
                                                                {
                                                                    
attacker.AttackPacket null;
                                                                }
                                                            }
                                                        }
                                                        if (
attacked.EntityFlag == EntityFlag.Entity)
                                                            
attacked.Owner.SendScreen(susetrue);
                                                        else
                                                            
attacked.MonsterInfo.SendScreen(suse);
                                                    }
                                                    else
                                                    {
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                                        {
                                                            
PrepareSpell(spellattacker.Owner);

                                                            
uint damage spell.Power;
                                                            
damage Math.Min(damageattacked.MaxHitpoints attacked.Hitpoints);
                                                            
attacked.Hitpoints += damage;
                                                            
Experience += damage;
                                                            
suse.AddTarget(attackeddamageattack);

                                                            if (
spell.NextSpellID != 0)
                                                            {
                                                                
attack.Damage spell.NextSpellID;
                                                                
attacker.AttackPacket attack;
                                                            }
                                                            else
                                                            {
                                                                
attacker.AttackPacket null;
                                                            }
                                                            if (
attacked.EntityFlag == EntityFlag.Entity)
                                                                
attacked.Owner.SendScreen(susetrue);
                                                            else
                                                                
attacked.MonsterInfo.SendScreen(suse);
                                                        }
                                                        else
                                                        {
                                                            
attacker.AttackPacket null;
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);

                                                        
uint damage spell.Power;
                                                        
damage Math.Min(damageattacked.MaxHitpoints attacked.Hitpoints);
                                                        
attacked.Hitpoints += damage;
                                                        
Experience += damage;
                                                        
suse.AddTarget(attackeddamageattack);

                                                        if (
spell.NextSpellID != 0)
                                                        {
                                                            
attack.Damage spell.NextSpellID;
                                                            
attacker.AttackPacket attack;
                                                        }
                                                        else
                                                        {
                                                            
attacker.AttackPacket null;
                                                        }
                                                        if (
attacked.EntityFlag == EntityFlag.Entity)
                                                            
attacked.Owner.SendScreen(susetrue);
                                                        else
                                                            
attacked.MonsterInfo.SendScreen(suse);
                                                    }
                                                    else
                                                    {
                                                        
attacker.AttackPacket null;
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion

                                #region AuroraLotus
                                
case 12370:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {

                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
attacker.Owner.SendScreen(susetrue);
                                            
FloorItem item = new FloorItem(true);
                                            
item.UID FloorItem.FloorUID.Next;
                                            
item.ItemID FloorItem.AuroraLotus;
                                            
item.MapID attacker.MapID;
                                            
item.X;
                                            
item.Y;
                                            
item.ItemColor = (Game.Enums.Color)25;
                                            
item.Type FloorItem.Effect;
                                            
item.mColor 13;
                                            
item.OwnerUID attacker.UID;
                                            
item.OwnerGuildUID attacker.GuildID;
                                            
item.Name spell.Name;
                                            
item.Owner attacker.Owner;
                                            
item.OnFloor Time32.Now;
                                            
item.FlowerType 3;
                                            
item.Timer Kernel.Gettime();
                                            
attacker.Owner.Map.AddFloorItem(item);
                                            
attacker.Owner.SendScreenSpawn(itemtrue);
                                            
attacker.Energy 0;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region FlameLotus
                                
case 12380:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {

                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
attacker.Owner.SendScreen(susetrue);
                                            
FloorItem item = new FloorItem(true);
                                            
item.UID FloorItem.FloorUID.Next;
                                            
item.ItemID FloorItem.FlameLotus;
                                            
item.MapID attacker.MapID;
                                            
item.X;
                                            
item.Y;
                                            
item.ItemColor = (Game.Enums.Color)25;
                                            
item.Type FloorItem.Effect;
                                            
item.mColor 13;
                                            
item.OwnerUID attacker.UID;
                                            
item.OwnerGuildUID attacker.GuildID;
                                            
item.Name spell.Name;
                                            
item.Owner attacker.Owner;
                                            
item.OnFloor Time32.Now;
                                            
item.FlowerType 3;
                                            
item.Timer Kernel.Gettime();
                                            
attacker.Owner.Map.AddFloorItem(item);
                                            
attacker.Owner.SendScreenSpawn(itemtrue);
                                            
attacker.Energy 0;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Revive
                                
case 1050:
                                case 
1100:
                                    {
                                        if (
attackedsob != null)
                                            return;
                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <=
                                        
spell.Distance)
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);
                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
suse.SpellLevel spell.Level;
                                                
suse.X;
                                                
suse.Y;
                                                
suse.AddTarget(attacked0attack);
                                                
attacked.Owner.Player.Action =
                                                
Game.Enums.ConquerAction.None;
                                                
attacked.Owner.ReviveStamp Time32.Now;
                                                
attacked.Owner.Attackable false;
                                                
attacked.Owner.Player.TransformationID 0;
                                                
attacked.Owner.Player.RemoveFlag((ulong)Update.Flags.Dead);
                                                
attacked.Owner.Player.RemoveFlag((ulong)Update.Flags.Ghost);
                                                
attacked.Owner.Player.Hitpoints attacked.Owner.Player.MaxHitpoints;
                                                
attacked.Ressurect();
                                                
attacked.Owner.SendScreen(susetrue);
                                                if (
attacker.Owner.Spells.ContainsKey(12390))
                                                {
                                                    if (
Kernel.Rate(Database.SpellTable.GetSpell(12390attacker.Owner).Percent))
                                                    {
                                                        
SpellUse susee = new SpellUse(true);
                                                        
susee.Attacker attacker.UID;
                                                        
susee.SpellID 12390;
                                                        
susee.SpellLevel attacker.Owner.Spells[12390].Level;
                                                        
susee.attacked.X;
                                                        
susee.attacked.Y;
                                                        
attacked.Owner.SendScreen(suseetrue);
                                                        
attacked.AddFlag((ulong)Update.Flags.Stigma);
                                                        
attacked.StigmaStamp Time32.Now;
                                                        
attacked.StigmaIncrease 15;
                                                        
attacked.StigmaTime 60;
                                                        
attacked.MagicShieldStamp Time32.Now;
                                                        
attacked.MagicShieldIncrease 15;
                                                        
attacked.MagicShieldTime 60;
                                                        
attacked.LoadTopStatus();
                                                        
attacked.AddFlag(Update.Flags.MagicShield);
                                                        
attacked.AddFlag(Update.Flags.StarOfAccuracy);
                                                        
attacked.AccuracyStamp Time32.Now;
                                                        
attacked.AccuracyTime 60;
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Linear spells
                                
case 11000:

                                case 
11005:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
                                        
Xattacker.YY, (byte)spell.RangeInLineAlgorithm.Algorithm.DDA);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
ila.InLine(attacked.Xattacked.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            continue;

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attackclient_Spell.LevelHu2);
                                                        
damage = (damage 46) / 100;
                                                        
suse.Effect1 attack.Effect1;

                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
suse.AddTarget(attackeddamageattack);
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
attackedsob _obj as SobNpcSpawn;

                                                    if (
ila.InLine(attackedsob.Xattackedsob.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedsobspell))
                                                            continue;

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
damage = (damage 46) / 100;
                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                        
suse.AddTarget(attackedsobdamageattack);
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Linear spells

                                
case 1045:
                                case 
1046:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
                                        
Xattacker.YY, (byte)spell.RangeInLineAlgorithm.Algorithm.DDA);
                                            
SpellUse suse = new SpellUse(true);
                                            
attacker.Stamina -= 0;//////////////
                                            
attacker.Stamina += 150;//////////
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
ila.InLine(attacked.Xattacked.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            continue;

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attackclient_Spell.LevelHu2);
                                                        
damage = (damage 46) / 100;
                                                        
suse.Effect1 attack.Effect1;

                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
suse.AddTarget(attackeddamageattack);
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
attackedsob _obj as SobNpcSpawn;

                                                    if (
ila.InLine(attackedsob.Xattackedsob.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedsobspell))
                                                            continue;

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
damage = (damage 46) / 100;
                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                        
suse.AddTarget(attackedsobdamageattack);
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region XPSpells inoffensive
                                
case 1015:
                                case 
1020:
                                case 
1025:
                                case 
1110:
                                case 
6011:
                                case 
10390:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
suse.AddTarget(attacked.UID0attack);
                                            if (
spell.ID == 6011)
                                            {
                                                
attacked.FatalStrikeStamp Time32.Now;
                                                
attacked.FatalStrikeTime 60;
                                                
attacked.AddFlag((ulong)Update.Flags.FatalStrike);
                                                
attacker.RemoveFlag((ulong)Update.Flags.Ride);
                                            }
                                            else if (
spell.ID == 1110 || spell.ID == 1025 || spell.ID == 10390)
                                            {
                                                if (!
attacked.OnKOSpell())
                                                    
attacked.KOCount 0;
                                                
attacked.KOSpell spell.ID;
                                                if (
spell.ID == 1110)
                                                {
                                                    
attacked.CycloneStamp Time32.Now;
                                                    
attacked.CycloneTime 20;
                                                    
attacked.AddFlag((ulong)Update.Flags.Cyclone);
                                                }
                                                else if (
spell.ID == 10390)
                                                {
                                                    
attacked.OblivionStamp Time32.Now;
                                                    
attacked.OblivionTime 20;
                                                    
attacked.AddFlag2((ulong)Update.Flags2.Oblivion);
                                                }
                                                else
                                                {
                                                    
attacked.SupermanStamp Time32.Now;
                                                    
attacked.SupermanTime 20;
                                                    
attacked.AddFlag((ulong)Update.Flags.Superman);
                                                }
                                            }
                                            else if (
spell.ID == 1020)
                                            {
                                                
attacked.ShieldStamp Time32.Now;
                                                
attacked.MagicShieldStamp Time32.Now;
                                                
attacked.MagicShieldTime 0;
                                                
attacked.ShieldTime 0;

                                                
attacked.AddFlag((ulong)Update.Flags.MagicShield);
                                                
attacked.ShieldStamp Time32.Now;
                                                
attacked.ShieldIncrease spell.PowerPercent;
                                                
attacked.ShieldTime 60;
                                            }
                                            else
                                            {
                                                
attacked.AccuracyStamp Time32.Now;
                                                
attacked.StarOfAccuracyStamp Time32.Now;
                                                
attacked.StarOfAccuracyTime 0;
                                                
attacked.AccuracyTime 0;

                                                
attacked.AddFlag((ulong)Update.Flags.StarOfAccuracy);
                                                
attacked.AccuracyStamp Time32.Now;
                                                
attacked.AccuracyTime = (byte)spell.Duration;
                                            }
                                            
attacked.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Circle spells
                                
case 1010:
                                case 
1120:
                                case 
1125:
                                case 
3090:
                                case 
5001:
                                case 
8030:
                                case 
1115:
                                    {
                                        if (
spell.ID == 10315)
                                        {
                                            if (
attacker.Owner.Weapons.Item1 == null) return;
                                            if (
attacker.Owner.Weapons.Item1.IsTwoHander()) return;
                                        }
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
UInt16 oxoy;
                                            
ox attacker.X;
                                            
oy attacker.Y;
                                            if (
spellID == 10315)
                                            {
                                                
Attack npacket = new Attack(true);
                                                
npacket.Attacker attacker.UID;
                                                
npacket.AttackType 53;
                                                
npacket.X;
                                                
npacket.Y;
                                                
Writer.WriteUInt16(spell.ID28npacket.ToArray());
                                                
Writer.WriteByte(spell.Level30npacket.ToArray());
                                                
attacker.Owner.SendScreen(npackettrue);
                                                
attacker.X;
                                                
attacker.Y;
                                                
attacker.SendSpawn(attacker.Owner);
                                            }

                                            List<
IMapObjectobjects = new List<IMapObject>();
                                            if (
attacker.Owner.Screen.Objects.Count() > 0)
                                                
objects GetObjects(oxoyattacker.Owner);
                                            if (
objects != null)
                                            {
                                                if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Range)
                                                {
                                                    if (
spellID == 10315)
                                                    {
                                                        foreach (
IMapObject objs in objects.ToArray())
                                                        {
                                                            if (
objs == null)
                                                                continue;

                                                            if (
objs.MapObjType == MapObjectType.Monster || objs.MapObjType == MapObjectType.Entity)
                                                            {
                                                                
attacked objs as Entity;
                                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                                {
                                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attackclient_Spell.LevelHu2);
                                                                        
damage = (uint)(damage 0.5);

                                                                        
suse.Effect1 attack.Effect1;
                                                                        if (
spell.Power 0)
                                                                        {
                                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                                            
damage Game.Attacking.Calculate.Magic(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                                            
damage = (uint)(damage 0.5);
                                                                            
suse.Effect1 attack.Effect1;
                                                                        }
                                                                        if (
spell.ID == 8030)
                                                                        {
                                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                                            
damage Game.Attacking.Calculate.Ranged(attackerattackedref attackclient_Spell.LevelHu2);
                                                                        }

                                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                                        
suse.AddTarget(attackeddamageattack);
                                                                    }
                                                                }
                                                            }
                                                            else if (
objs.MapObjType == MapObjectType.SobNpc)
                                                            {
                                                                
attackedsob objs as SobNpcSpawn;
                                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                                {
                                                                    if (
CanAttack(attackerattackedsobspell))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                        if (
spell.Power 0)
                                                                        {
                                                                            
damage Game.Attacking.Calculate.Magic(attackerattackedsobspellref attack);
                                                                        }
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        if (
spell.ID == 8030)
                                                                            
damage Game.Attacking.Calculate.Ranged(attackerattackedsobref attack);
                                                                        
suse.Effect1 attack.Effect1;
                                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                        
suse.AddTarget(attackedsobdamageattack);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                        {
                                                            if (
_obj == null)
                                                                continue;
                                                            if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                            {
                                                                
attacked _obj as Entity;
                                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                                {
                                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Magic(attackerattackedspellref attackclient_Spell.LevelHu2);

                                                                        if (
spell.ID == 1115)
                                                                        {
                                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                                            
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                                            
damage = (uint)(damage 0.55);
                                                                        }
                                                                        else if (
spell.Power 0)
                                                                        {
                                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                                            
damage Game.Attacking.Calculate.Magic(attackerattackedspellref attackclient_Spell.LevelHu2);

                                                                        }
                                                                        
suse.Effect1 attack.Effect1;
                                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                                        
suse.AddTarget(attackeddamageattack);


                                                                    }
                                                                }
                                                            }
                                                            else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                            {
                                                                
attackedsob _obj as SobNpcSpawn;
                                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                                {
                                                                    if (
CanAttack(attackerattackedsobspell))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                        if (
spell.Power 0)
                                                                            
damage Game.Attacking.Calculate.Magic(attackerattackedsobspellref attack);
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        if (
spell.ID == 8030)
                                                                            
damage Game.Attacking.Calculate.Ranged(attackerattackedsobref attack);

                                                                        
suse.Effect1 attack.Effect1;
                                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                        
suse.AddTarget(attackedsobdamageattack);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    
attacker.AttackPacket null;
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                            
Mr_Panda.Game.Calculations.IsBreaking(attacker.Owneroxoy);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Buffers
                                
case 1075:
                                case 
1085:
                                case 
1090:
                                case 
1095:
                                case 
3080:
                                case 
10405:
                                case 
30000:
                                    {
                                        if (
attackedsob != null)
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);

                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
suse.SpellLevel spell.Level;
                                                
suse.X;
                                                
suse.Y;

                                                
suse.AddTarget(attackedsob0null);

                                                
attacker.Owner.SendScreen(susetrue);
                                            }
                                        }
                                        else
                                        {
                                            if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                            {
                                                if (
CanUseSpell(spellattacker.Owner))
                                                {
                                                    
PrepareSpell(spellattacker.Owner);

                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;

                                                    
suse.AddTarget(attacked0null);

                                                    if (
spell.ID == 1075 || spell.ID == 1085)
                                                    {
                                                        if (
spell.ID == 1075)
                                                        {
                                                            
attacked.AddFlag(Update.Flags.Invisibility);
                                                            
attacked.InvisibilityStamp Time32.Now;
                                                            
attacked.InvisibilityTime = (byte)spell.Duration;
                                                            if (
attacked.EntityFlag == EntityFlag.Entity)
                                                                
attacked.Owner.Send(Constants.Invisibility(spell.Duration));
                                                        }
                                                        else
                                                        {
                                                            
attacked.AccuracyStamp Time32.Now;
                                                            
attacked.StarOfAccuracyStamp Time32.Now;
                                                            
attacked.StarOfAccuracyTime 0;
                                                            
attacked.AccuracyTime 0;
                                                            
attacker.Stamina -= 0;//////////////
                                                            
attacker.Stamina += 150;//////////

                                                            
attacked.AddFlag(Update.Flags.StarOfAccuracy);
                                                            
attacked.StarOfAccuracyStamp Time32.Now;
                                                            
attacked.StarOfAccuracyTime = (byte)spell.Duration;
                                                            if (
attacked.EntityFlag == EntityFlag.Entity)
                                                                
attacked.Owner.Send(Constants.Accuracy(spell.Duration));
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (
spell.ID == 1090)
                                                        {
                                                            
attacked.ShieldTime 0;
                                                            
attacked.ShieldStamp Time32.Now;
                                                            
attacked.MagicShieldStamp Time32.Now;
                                                            
attacked.MagicShieldTime 0;

                                                            
attacked.AddFlag(Update.Flags.MagicShield);
                                                            
attacked.MagicShieldStamp Time32.Now;
                                                            
attacked.MagicShieldIncrease 1.1f;//spell.PowerPercent;
                                                            
attacked.MagicShieldTime = (byte)spell.Duration;
                                                            if (
attacked.EntityFlag == EntityFlag.Entity)
                                                                
attacked.Owner.Send(Constants.Shield(spell.PowerPercentspell.Duration));
                                                        }
                                                        else if (
spell.ID == 1095)
                                                        {
                                                            
attacked.AddFlag(Update.Flags.Stigma);
                                                            
attacked.StigmaStamp Time32.Now;
                                                            
attacked.StigmaIncrease spell.PowerPercent;
                                                            
attacked.StigmaTime = (byte)spell.Duration;
                                                            if (
attacked.EntityFlag == EntityFlag.Entity)
                                                                
attacked.Owner.Send(Constants.Stigma(spell.PowerPercentspell.Duration));
                                                        }
                                                        else if (
spell.ID == 30000)
                                                        {
                                                            if (
attacked.ContainsFlag2(Update.Flags2.AzureShield))
                                                            {
                                                                return;
                                                            }

                                                            if (
spell.Level == 0)
                                                                
attacked.AzureShieldDefence 3000;
                                                            else
                                                                
attacked.AzureShieldDefence = (ushort)(3000 spell.Level);
                                                            
attacked.AzureShieldLevel spell.Level;
                                                            
attacked.MagicShieldStamp Time32.Now;

                                                            
attacked.AzureShieldStamp DateTime.Now;
                                                            
attacked.AddFlag2(Update.Flags2.AzureShield);
                                                            
attacked.MagicShieldTime spell.Percent;
                                                            
attacked.AzureShieldPacket();
                                                            if (
attacked.EntityFlag == EntityFlag.Entity)
                                                                
attacked.Owner.Send(Constants.Shield(12000attacked.MagicShieldTime));
                                                        }
                                                        if (
spell.ID == 10405 && attacked.Dead)
                                                        {
                                                            if (
attacked.EntityFlag != EntityFlag.Entity) break;
                                                            if (!
attacked.ContainsFlag2(Update.Flags2.SoulShackle))
                                                            {
                                                                if ((
attacked.BattlePower attacker.BattlePower) > 20) break;
                                                                {
                                                                    
#region Perfection
                                                                    
Game.Enums.PerfectionEffect effect Enums.PerfectionEffect.FreeSoul;
                                                                    
byte chance 0;
                                                                    new 
MsgRefineEffect().HandleFreeSoul(attackerref chance);
                                                                    if (
Kernel.Rate(chance))
                                                                    {
                                                                        new 
MsgRefineEffect().SendEffect(attackedattackereffect);
                                                                        break;
                                                                    }
                                                                    
#endregion
                                                                    
attacker.SpellStamp Time32.Now;
                                                                    
attacked.AddFlag(Update.Flags.Dead);
                                                                    
attacked.AddFlag2(Update.Flags2.SoulShackle);
                                                                    
attacked.ShackleStamp Time32.Now;
                                                                    
attacked.ShackleTime 90;
                                                                    
Network.GamePackets.Update upgrade = new Network.GamePackets.Update(true);
                                                                    
upgrade.UID attacked.UID;
                                                                    
upgrade.Append((byte)Network.GamePackets.Update.DataType.SoulShackle111900spell.Level);
                                                                    
attacked.Owner.Send(upgrade.ToArray());
                                                                    if (
attacked.EntityFlag == EntityFlag.Entityattacked.Owner.Send(Constants.Shackled(attacked.ShackleTime));
                                                                }
                                                            }
                                                        }
                                                    }
                                                    if (
attacked.EntityFlag == EntityFlag.Entity)
                                                        
attacked.Owner.SendScreen(susetrue);
                                                    else
                                                        
attacked.MonsterInfo.SendScreen(suse);

                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Percent
                                
case 3050:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (
attackedsob != null)
                                            {
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Distance)
                                                {
                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;

                                                    if (
CanAttack(attackerattackedsobspell))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        
uint damage Game.Attacking.Calculate.Percent(attackedsobspell.PowerPercent);
                                                        
attackedsob.Hitpoints -= damage;

                                                        
suse.AddTarget(attackedsobdamageattack);

                                                        
attacker.Owner.SendScreen(susetrue);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                                {
                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;

                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        
uint damage Game.Attacking.Calculate.Percent(attackedspell.PowerPercent);
                                                        if (
attacked.Owner != null)
                                                        {
                                                            
attacker.Owner.UpdateQualifier(attacker.Ownerattacked.Ownerdamage);
                                                        }
                                                        
attacked.Hitpoints -= damage;

                                                        
suse.AddTarget(attackeddamageattack);

                                                        if (
attacked.EntityFlag == EntityFlag.Entity)
                                                            
attacked.Owner.SendScreen(susetrue);
                                                        else
                                                            
attacked.MonsterInfo.SendScreen(suse);
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion

                                #region ExtraXP
                                
case 1040:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
PrepareSpell(spellattacker.Owner);
                                            if (
attacker.Owner.Team != null)
                                            {
                                                foreach (
Client.GameState teammate in attacker.Owner.Team.Teammates)
                                                {
                                                    if (
teammate.Player.UID != attacker.UID)
                                                    {
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yteammate.Player.Xteammate.Player.Y) <= 18)
                                                        {
                                                            
teammate.XPCount += 20;
                                                            
suse.AddTarget(teammate.Player20null);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region WeaponSpells
                                #region Circle
                                
case 5010:
                                case 
7020:
                                    {

                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            if (
suse.SpellID != 10415)
                                            {
                                                
suse.X;
                                                
suse.Y;
                                            }
                                            else
                                            {
                                                
suse.6;
                                            }

                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= attacker.AttackRange 1)
                                            {
                                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (
_obj == null)
                                                        continue;
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                        {
                                                            if (
attacked.ContainsFlag(Update.Flags.Fly))
                                                                return;
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
PrepareSpell(spellattacker.Owner);

                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                                
suse.Effect1 attack.Effect1;

                                                                
ReceiveAttack(attackerattackedattackref damagespell);

                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                        {
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
PrepareSpell(spellattacker.Owner);
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }

                                        break;
                                    }
                                
#endregion

                                #region Single target
                                //     case 11140://WindStorm
                                //   case 10490:
                                //     {
                                //       if (CanUseSpell(spell, attacker.Owner))
                                //     {
                                //       PrepareSpell(spell, attacker.Owner);
                                //
                                //      TryTrip suse = new TryTrip(true);
                                //    suse.Attacker = attacker.UID;
                                //          suse.SpellID = spell.ID;
                                //           suse.SpellLevel = spell.Level;
                                //
                                //      if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
                                //    {
                                //      if (attackedsob != null)
                                //    {
                                //      if (CanAttack(attacker, attackedsob, spell))
                                //    {
                                //      suse.Attacked = attackedsob.UID;
                                //    PrepareSpell(spell, attacker.Owner);
                                //  attack.Effect1 = Attack.AttackEffects1.None;
                                //                                                       uint AllDamage = 0;
                                //                                                     uint damage1 = 0;
                                //                                                   uint damage2 = 0;
                                //                                                 uint damage = 0;
                                //                                               Network.GamePackets.Attack.AttackEffects1 Eff1 = 0;
                                //                                             Network.GamePackets.Attack.AttackEffects1 Eff2 = 0;
                                //                                           Network.GamePackets.Attack.AttackEffects1 Eff3 = 0;
                                //                                         damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
                                //                                       AllDamage += damage;
                                //                                     Eff1 = attack.Effect1;
                                //                                   attack.Effect1 = Attack.AttackEffects1.None;
                                //                                 if (attackedsob.Hitpoints <= AllDamage)
                                //                               {
                                //                                 suse.Effect1 = attack.Effect1;
                                //                               suse.Damage += damage;
                                //
                                //                  }
                                //                else
                                //              {
                                //                                damage1 = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
                                //                              Eff2 = attack.Effect1;
                                //                            attack.Effect1 = Attack.AttackEffects1.None;
                                //                          AllDamage += damage1;
                                //                        if (attackedsob.Hitpoints <= AllDamage)
                                //                      {
                                //                        suse.Effect1 = attack.Effect1;
                                //                     suse.Effect2 = attack.Effect2;
                                //                     suse.Damage += damage;
                                //               }
                                //             else
                                //           {
                                //             damage2 = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
                                //           Eff3 = attack.Effect1;
                                //         attack.Effect1 = Attack.AttackEffects1.None;
                                //       AllDamage += damage2;
                                //                                                           //     suse.Effect1 = attack.Effect1;
                                //                                                              suse.Effect2 = attack.Effect2;
                                //                                                            suse.Damage = damage;
                                //
                                //                      }
                                //                }
                                //              if (spellID == 10490)
                                //            {
                                //              if (attacker.EpicMonk())
                                //            {
                                //              if (attacker.Owner.Spells.ContainsKey(12570))
                                //                                                      {
                                //                                                        attacker.WrathoftheEmperor = true;
                                //                                                      attacker.WrathoftheEmperorStamp = DateTime.Now;
                                //                                                }
                                //                                          }
                                //                                    }
                                //                                  ReceiveAttack(attacker, attackedsob, attack, AllDamage, spell);
                                //
                                //              }
                                //        }
                                //      else
                                //                                        {
                                //                                          if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
                                //                                        {
                                //                                          suse.Attacked = attacked.UID;
                                //                                        PrepareSpell(spell, attacker.Owner);
                                //                                      attack.Effect1 = Attack.AttackEffects1.None;
                                //                                    uint AllDamage = 0;
                                //                                  uint damage1 = 0;
                                //                                uint damage2 = 0;
                                //                              uint damage = 0;
                                //                            Network.GamePackets.Attack.AttackEffects1 Eff1 = 0;
                                //                          Network.GamePackets.Attack.AttackEffects1 Eff3 = 0;
                                //                        damage = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
                                //                      damage = (uint)(damage * 0.5);
                                //                    AllDamage += damage;
                                //                  Eff1 = attack.Effect1;
                                //                attack.Effect1 = Attack.AttackEffects1.None;
                                //              if (attacked.Hitpoints <= AllDamage)
                                //            {
                                //              suse.Effect1 = attack.Effect1;
                                //            suse.Damage += damage;
                                //      }
                                //    else
                                //                                                {
                                //                                                  damage1 = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
                                //                                                damage = (uint)(damage * 0.5);
                                //                                              AllDamage += damage;
                                //                                            Eff3 = attack.Effect1;
                                //                                          attack.Effect1 = Attack.AttackEffects1.None;
                                //                                        AllDamage += damage1;
                                //                                      if (attacked.Hitpoints <= AllDamage)
                                //                                    {
                                //                                      suse.Effect1 = attack.Effect1;
                                //                                    suse.Effect2 = attack.Effect2;
                                //                                  suse.Damage += damage;
                                //                            }
                                //                          else
                                //                        {
                                //                          damage2 = Game.Attacking.Calculate.Melee(attacker, attacked, ref attack);
                                //                        damage = (uint)(damage * 0.5);
                                //                      Eff3 = attack.Effect1;
                                //                    attack.Effect1 = Attack.AttackEffects1.None;
                                //                  AllDamage += damage2;
                                //                suse.Effect1 = attack.Effect1;
                                //              suse.Effect2 = attack.Effect2;
                                //            suse.Damage = damage;
                                //      }
                                //                                 }
                                //                               if (spellID == 10490)
                                //                             {
                                //                               if (attacker.EpicMonk())
                                //                             {
                                //                               if (attacker.Owner.Spells.ContainsKey(12570))
                                //                             {
                                //                               attacker.WrathoftheEmperor = true;
                                //                             attacker.WrathoftheEmperorStamp = DateTime.Now;
                                //                       }
                                //                 }
                                //           }
                                //        ReceiveAttack(attacker, attacked, attack, ref AllDamage, spell);
                                //    }
                                //                                      }
                                //                                    //attacker.AttackPacket = null;
                                //                              }
                                //                            else
                                //                          {
                                //                            attacker.AttackPacket = null;
                                //                      }
                                //                    attacker.Owner.SendScreen(suse, true);
                                //              }
                                //            //attacker.AttackPacket = null;
                                //          break;
                                //    }
                                //case 1290:
                                //                 case 5030:
                                //               case 5040:
                                //             case 7000:
                                //           case 7010:
                                //         case 7030:
                                //       case 7040:
                                //         {
                                //           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.SpellLevelHu = client_Spell.LevelHu2;
                                //                            suse.X = X;
                                //                          suse.Y = Y;
                                //
                                //      if (Kernel.GetDistance(attacker.X, attacker.Y, X, Y) <= attacker.AttackRange + 1)
                                //    {
                                //      if (attackedsob != null)
                                //    {
                                //      if (CanAttack(attacker, attackedsob, spell))
                                //    {
                                //      PrepareSpell(spell, attacker.Owner);
                                //                         attack.Effect1 = Attack.AttackEffects1.None;
                                //                       uint damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack);
                                //                     ReceiveAttack(attacker, attackedsob, attack, damage, spell);
                                //
                                //                  suse.AddTarget(attackedsob, damage, attack);
                                //            }
                                //      }
                                //    else
                                //                      {
                                //                        if (CanAttack(attacker, attacked, spell, attack.AttackType == Attack.Melee))
                                //                      {
                                //                        PrepareSpell(spell, attacker.Owner);
                                //
                                //                  attack.Effect1 = Attack.AttackEffects1.None;
                                //                uint damage = Game.Attacking.Calculate.Melee(attacker, attacked, spell, ref attack, client_Spell.LevelHu2);
                                //              damage = (uint)(damage * 0.5);
                                //            suse.Effect1 = attack.Effect1;
                                //
                                //                  ReceiveAttack(attacker, attacked, attack, ref damage, spell);
                                //
                                //                  suse.AddTarget(attacked, damage, attack);
                                //            }
                                //      }
                                //    attacker.AttackPacket = null;
                                //     }
                                //                else
                                //              {
                                //                attacker.AttackPacket = null;
                                //          }
                                //        attacker.Owner.SendScreen(suse, true);
                                //  }
                                //                                attacker.AttackPacket = null;
                                //                                  break;
                                //                                }
                                #endregion
                                #region Single target
                                
case 11140:
                                case 
10490:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
TryTrip suse = new TryTrip(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;

                                            
suse.SpellLevel spell.Level;

                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= attacker.AttackRange 1)
                                            {
                                                if (
attackedsob != null)
                                                {
                                                    if (
CanAttack(attackerattackedsobspell))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        if (
spellID == 10490)
                                                        {
                                                            if (
attacker.EpicMonk())
                                                            {
                                                                if (
attacker.Owner.Spells.ContainsKey(12570))
                                                                {
                                                                    
attacker.WrathoftheEmperor true;
                                                                    
attacker.WrathoftheEmperorStamp DateTime.Now;
                                                                }
                                                            }
                                                        }
                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                        
suse.Damage damage;
                                                        
suse.Attacked attackedsob.UID;
                                                    }
                                                }
                                                else
                                                {
                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                        if (
spell.ID == 11140)
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
//var damage = Game.Attacking.Calculate.Melee(attacker, attackedsob, ref attack) / 1;
                                                            
damage Game.Attacking.Calculate.Melee(attackerattackedref attack) / 2;
                                                        }
                                                        if (
spell.ID == 10490)
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
damage Game.Attacking.Calculate.Melee(attackerattackedref attackclient_Spell.LevelHu2);
                                                        }
                                                        if (
spellID == 10490)
                                                        {
                                                            if (
attacker.EpicMonk())
                                                            {
                                                                if (
attacker.Owner.Spells.ContainsKey(12570))
                                                                {
                                                                    
attacker.WrathoftheEmperor true;
                                                                    
attacker.WrathoftheEmperorStamp DateTime.Now;
                                                                }
                                                            }
                                                        }
                                                        
ReceiveAttack(attackerattackedattackref damagespell);
                                                        
suse.Damage damage;
                                                        
suse.Attacked attacked.UID;
                                                    }
                                                }
                                                
//  attacker.AttackPacket = null;
                                            
}
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        
//  attacker.AttackPacket = null;
                                        
break;
                                    }
                                case 
1290:
                                case 
5030:
                                case 
5040:
                                case 
7000:
                                case 
7010:
                                case 
7030:
                                case 
7040:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
suse.X;
                                            
suse.Y;

                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= attacker.AttackRange 1)
                                            {
                                                if (
attackedsob != null)
                                                {
                                                    if (
CanAttack(attackerattackedsobspell))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                        
suse.AddTarget(attackedsobdamageattack);
                                                    }
                                                }
                                                else
                                                {
                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                        
damage = (uint)(damage 0.5);
                                                        
suse.Effect1 attack.Effect1;

                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
suse.AddTarget(attackeddamageattack);
                                                    }
                                                }
                                                
attacker.AttackPacket null;
                                            }
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        
attacker.AttackPacket null;
                                        break;
                                    }
                                
#endregion

                                #region Sector
                                
case 1250:
                                case 
5050:
                                case 
5020:
                                case 
1300:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
suse.Y;
                                            
Sector sector = new Sector(attacker.Xattacker.YXY);
                                            
sector.Arrange(spell.Sectorspell.Range);
                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Distance 1)
                                            {
                                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (
_obj == null)
                                                        continue;
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;

                                                        if (
sector.Inside(attacked.Xattacked.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);

                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedattackref damagespell);

                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;

                                                        if (
sector.Inside(attackedsob.Xattackedsob.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);

                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion

                                #region Fly
                                
case 8002:
                                case 
8003:
                                    {
                                        if (
attacker.Owner.Map.ID == 1645)
                                        {
                                            
Kernel.SendWorldMessage(new Message("Mr: " attacker.Name " You Can`t Use Fly Here !!!"System.Drawing.Color.WhiteMessage.Talk), Program.Values);
                                            return;
                                        }
                                        if (
attacker.Owner.Map.ID == 1645)
                                        {
                                            
Kernel.SendWorldMessage(new Message("Mr: " attacker.Name " You Can`t Use Fly Here !!!"System.Drawing.Color.WhiteMessage.Talk), Program.Values);
                                            return;
                                        }
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (
attacker.MapID == 1950)
                                                return;
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
attacked.FlyStamp Time32.Now;
                                            
attacked.FlyTime = (byte)spell.Duration;

                                            
suse.AddTarget(attackerattacker.FlyTimenull);

                                            
attacker.AddFlag(Update.Flags.Fly);
                                            
attacker.RemoveFlag(Update.Flags.Ride);
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion


                                #region Ninja Spells
                                
case 6010:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;

                                            
attacker.AddFlag(Update.Flags.ShurikenVortex);
                                            
attacker.RemoveFlag(Update.Flags.Ride);
                                            
attacker.ShurikenVortexStamp Time32.Now;
                                            
attacker.ShurikenVortexTime 20;

                                            
attacker.Owner.SendScreen(susetrue);

                                            
attacker.VortexPacket = new Attack(true);
                                            
attacker.VortexPacket.Decoded true;
                                            
attacker.VortexPacket.Damage 6012;
                                            
attacker.VortexPacket.AttackType Attack.Magic;
                                            
attacker.VortexPacket.Attacker attacker.UID;
                                        }
                                        break;
                                    }
                                case 
6012://VortexRespone
                                    
{
                                        if (!
attacker.ContainsFlag(Update.Flags.ShurikenVortex))
                                        {
                                            
attacker.AttackPacket null;
                                            break;
                                        }
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.attacker.X;
                                        
suse.attacker.Y;
                                        
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                        
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                        {
                                            if (
_obj == null)
                                                continue;
                                            if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                            {
                                                
attacked _obj as Entity;
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                {
                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                        
//   damage = (UInt32)((damage * 25) / 100);
                                                        
suse.Effect1 attack.Effect1;

                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
suse.AddTarget(attackeddamageattack);
                                                    }
                                                }
                                            }
                                            else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                            {
                                                
attackedsob _obj as SobNpcSpawn;
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                {
                                                    if (
CanAttack(attackerattackedsobspell))
                                                    {
                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
suse.Effect1 attack.Effect1;
                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                        
suse.AddTarget(attackedsobdamageattack);
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.Owner.SendScreen(susetrue);
                                        break;
                                    }
                                case 
6001:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
if (Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Distance)
                                            {
                                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (
_obj.MapObjType == MapObjectType.Entity || _obj.MapObjType == MapObjectType.Monster)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
attacked.MapObjType == MapObjectType.Monster)
                                                            if (
attacked.MonsterInfo.Boss)
                                                                continue;
                                                        if (
Kernel.GetDistance(XYattacked.Xattacked.Y) <= spell.Range)
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
int potDifference attacker.BattlePower attacked.BattlePower;

                                                                
int rate spell.Percent potDifference 20;

                                                                if (
Kernel.Rate(rate))
                                                                {
                                                                    
attacked.ToxicFogStamp Time32.Now;
                                                                    
attacked.ToxicFogLeft 20;
                                                                    
attacked.ToxicFogPercent spell.PowerPercent;
                                                                    
attacked.AddFlag(Update.Flags.Poisoned);
                                                                    
suse.AddTarget(attacked1null);
                                                                }
                                                                else
                                                                {
                                                                    
suse.AddTarget(attacked0null);
                                                                    
suse.Targets[attacked.UID].Hit false;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                case 
6000:
                                    {
                                        
// if (Time32.Now >= attacker.SpellStamp.AddMilliseconds(1))
                                        
{
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
ushort XxYx;
                                                if (
attacked != null)
                                                {
                                                    
Xx attacked.X;
                                                    
Yx attacked.Y;
                                                }
                                                else
                                                {
                                                    
Xx attackedsob.X;
                                                    
Yx attackedsob.Y;
                                                }
                                                if (
Kernel.GetDistance(attacker.Xattacker.YXxYx) <= 5)
                                                {
                                                    if (
attackedsob == null)
                                                        if (
attacked.ContainsFlag(Network.GamePackets.Update.Flags.Fly))
                                                            return;
                                                    
//if (attacked.ContainsFlag(Network.GamePackets.Update.Flags.Fly))
                                                    //  return;
                                                    
if (attacker.ContainsFlag(Network.GamePackets.Update.Flags.Fly))
                                                        return;
                                                    
PrepareSpell(spellattacker.Owner);

                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;
                                                    
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                                    
bool send false;

                                                    if (
attackedsob == null)
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                            
suse.Effect1 attack.Effect1;
                                                            
ReceiveAttack(attackerattackedattackref damagespell);
                                                            
suse.AddTarget(attackeddamageattack);
                                                            
send true;

                                                            if (
attacker.Owner.Spells.ContainsKey(11230) && !attacked.Dead)
                                                            {
                                                                var 
attacker.Owner.Spells[11230];
                                                                var 
spellz Database.SpellTable.SpellInformations[s.ID][s.Level];
                                                                if (
spellz != null)
                                                                {
                                                                    if (
Kernel.Rate(spellz.Percent))
                                                                    {
                                                                        
SpellUse ssuse = new SpellUse(true);
                                                                        
ssuse.Attacker attacker.UID;
                                                                        
ssuse.SpellID spellz.ID;

                                                                        
ssuse.SpellLevel spellz.Level;
                                                                        
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack) / 2;
                                                                        
damage 1000;
                                                                        
ssuse.AddTarget(attacked, new SpellUse.DamageClass().Damage damageattack);
                                                                        
ReceiveAttack(attackerattackedattackref damagespellz);
                                                                        
attacker.Owner.SendScreen(ssusetrue);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Calculate.Melee(attackerattackedsobref attack);
                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                            
suse.Effect1 attack.Effect1;

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                            
send true;
                                                        }
                                                    }
                                                    if (
send)
                                                        
attacker.Owner.SendScreen(susetrue);
                                                    
attacker.SpellStamp Time32.Now;
                                                }
                                                else
                                                {
                                                    
attacker.AttackPacket null;
                                                }
                                            }
                                        }
                                        break;
                                    }


                                case 
6002:
                                    {
                                        if (
attackedsob != null)
                                            return;
                                        if (
attacked.EntityFlag == EntityFlag.Monster)
                                            return;
                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);

                                                
int potDifference attacker.BattlePower attacked.BattlePower;

                                                
int rate spell.Percent potDifference;

                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
suse.SpellLevel spell.Level;
                                                
suse.X;
                                                
suse.Y;
                                                
//suse.SpellLevelHu = client_Spell.LevelHu2;

                                                
if (CanAttack(attackerattackedspellfalse))
                                                {
                                                    
suse.AddTarget(attacked1attack);
                                                    if (
Calculate.RateStatus(35))//Kernel.Rate(rate))
                                                    
{
                                                        
attacked.AddFlag2(Update.Flags2.EffectBall);
                                                        
attacked.NoDrugsStamp Time32.Now;
                                                        
attacked.NoDrugsTime = (short)spell.Duration;
                                                        if (
attacked.EntityFlag == EntityFlag.Entity)
                                                            
attacked.Owner.Send(Constants.NoDrugs(spell.Duration));
                                                    }
                                                    else
                                                    {
                                                        
suse.Targets[attacked.UID].Hit false;
                                                        
suse.Targets[attacked.UID].Damage spell.ID;
                                                    }

                                                    
attacked.Owner.SendScreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                case 
6004:
                                    {
                                        if (
attackedsob != null)
                                            return;
                                        if (
attacked.EntityFlag == EntityFlag.Monster)
                                            return;
                                        if (!
attacked.ContainsFlag(Update.Flags.Fly))
                                            return;
                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);

                                                
int potDifference attacker.BattlePower attacked.BattlePower;

                                                
int rate spell.Percent potDifference;

                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
suse.SpellLevel spell.Level;
                                                
suse.X;
                                                
suse.Y;
                                                
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                                
if (CanAttack(attackerattackedspellfalse))
                                                {
                                                    
uint dmg Calculate.Percent(attacked0.1F);
                                                    
suse.AddTarget(attackeddmgattack);

                                                    if (
Kernel.Rate(rate))
                                                    {
                                                        
attacked.Hitpoints -= dmg;
                                                        
attacked.RemoveFlag(Update.Flags.Fly);
                                                    }
                                                    else
                                                    {
                                                        
suse.Targets[attacked.UID].Hit false;
                                                    }

                                                    
attacked.Owner.SendScreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                case 
11180:
                                    {
                                        if (
attacked != null)
                                        {
                                            if (
attacked.ContainsFlag(Update.Flags.Fly))
                                                return;
                                            if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                            {
                                                if (
CanUseSpell(spellattacker.Owner))
                                                {
                                                    if (!
Kernel.Rate(Math.Max(5100 - (attacked.BattlePower attacker.BattlePower) / 5))) return;
                                                    
PrepareSpell(spellattacker.Owner);
                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                                    
suse.attacked.X;
                                                    
suse.attacked.Y;
                                                    
ushort newx attacker.X;
                                                    
ushort newy attacker.Y;
                                                    
Map.Pushback(ref newxref newyattacked.Facing5);
                                                    if (
attacker.Owner.Map.Floor[newxnewyMapObjectType.Entityattacked])
                                                    {
                                                        
suse.attacked.newx;
                                                        
suse.attacked.newy;
                                                    }
                                                    
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
                                                    if (
CanAttack(attackerattackedspellfalse))
                                                    {
                                                        
tar.Damage Calculate.Melee(attackerattackedref attack) / 2;
                                                        
suse.AddTarget(attackedtarattack);
                                                        
ReceiveAttack(attackerattackedattackref tar.Damagespell);
                                                    }
                                                    if (
attacker.EntityFlag == EntityFlag.Entity)
                                                        
attacker.Owner.SendScreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                case 
11170:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {

                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
                                            foreach (var 
t in attacker.Owner.Screen.Objects)
                                            {
                                                if (
== null)
                                                    continue;
                                                if (
t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
                                                {
                                                    var 
target as Entity;
                                                    if (
Kernel.GetDistance(XYtarget.Xtarget.Y) <= spell.Range)
                                                    {
                                                        if (
CanAttack(attackertargetspellfalse))
                                                        {
                                                            
tar.Damage Calculate.Melee(attackertargetspellref attackclient_Spell.LevelHu2) / 4;
                                                            
tar.Hit true;
                                                            
suse.AddTarget(targettarattack);
                                                            
ReceiveAttack(attackertargetattackref tar.Damagespell);
                                                        }
                                                    }
                                                }
                                            }

                                            if (
attacker.EntityFlag == EntityFlag.Entity)
                                                
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region InfernalEcho
                                
case 12550:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            var 
map attacker.Owner.Map;
                                            if (!
map.Floor[XYMapObjectType.Itemnull]) return;
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;
                                            
suse.SpellEffect 0;
                                            
suse.AddTarget(attacker0null);
                                            
attacker.Owner.SendScreen(susetrue);

                                            
Random R = new Random();
                                            
int Nr R.Next(13);
                                            switch (
spell.Level)
                                            {
                                                
#region case 0 - 1 - 2 - 3 - 4 - 5
                                                
case 0:
                                                case 
1:
                                                case 
2:
                                                case 
3:
                                                case 
4:
                                                case 
5:
                                                    {
                                                        var 
area2 GetLocation2(attacker.Xattacker.Y);
                                                        
int count 3;
                                                        List<
System.Drawing.PointArea = new List<Point>();
                                                        for (
int i 0360+= spell.Sector)
                                                        {
                                                            if (
Area.Count >= count)
                                                            {
                                                                break;
                                                            }
                                                            
int r i;
                                                            var 
distance Kernel.Random.Next(spell.Rangespell.Distance);
                                                            var 
x2 = (ushort)(+ (distance Math.Cos(r)));
                                                            var 
y2 = (ushort)(+ (distance Math.Sin(r)));
                                                            
System.Drawing.Point point = new System.Drawing.Point((int)x2, (int)y2);
                                                            if (!
Area.Contains(point))
                                                            {
                                                                
Area.Add(point);
                                                            }
                                                            else
                                                            {
                                                                
i--;
                                                            }
                                                        }
                                                        if (
Nr == 1)
                                                        {
                                                            foreach (var 
a in area2)
                                                            {
                                                                
FloorItem item = new FloorItem(true);
                                                                
item.ItemID 1397;
                                                                
item.MapID attacker.MapID;
                                                                
item.Type FloorItem.Effect;
                                                                
item.= (ushort)a.X;
                                                                
item.= (ushort)a.Y;
                                                                
item.OnFloor Time32.Now;
                                                                
item.Owner attacker.Owner;
                                                                
item.UID FloorItem.FloorUID.Next;
                                                                while (
attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
                                                                    
item.UID FloorItem.FloorUID.Next;
                                                                
item.mColor 14;
                                                                
item.OwnerUID attacker.UID;
                                                                
item.OwnerGuildUID attacker.GuildID;
                                                                
item.FlowerType 0;
                                                                
item.Timer Kernel.TqTimer(DateTime.Now.AddSeconds(3));
                                                                
item.Name "InfernalEcho";
                                                                
attacker.Owner.SendScreenSpawn(itemtrue);
                                                                
attacker.AttackPacket null;
                                                            }
                                                        }
                                                        else if (
Nr == 2)
                                                        {
                                                            foreach (var 
a in Area)
                                                            {
                                                                
FloorItem item = new FloorItem(true);
                                                                
item.ItemID 1397;
                                                                
item.MapID attacker.MapID;
                                                                
item.Type FloorItem.Effect;
                                                                
item.= (ushort)a.X;
                                                                
item.= (ushort)a.Y;
                                                                
item.OnFloor Time32.Now;
                                                                
item.Owner attacker.Owner;
                                                                
item.UID FloorItem.FloorUID.Next;
                                                                while (
attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
                                                                    
item.UID FloorItem.FloorUID.Next;
                                                                
item.mColor 14;
                                                                
item.OwnerUID attacker.UID;
                                                                
item.OwnerGuildUID attacker.GuildID;
                                                                
item.FlowerType 0;
                                                                
item.Timer Kernel.TqTimer(DateTime.Now.AddSeconds(3));
                                                                
item.Name "InfernalEcho";
                                                                
attacker.Owner.SendScreenSpawn(itemtrue);
                                                                
attacker.AttackPacket null;
                                                            }
                                                        }
                                                        else if (
Nr == 3)
                                                        {
                                                            foreach (var 
a in Area)
                                                            {
                                                                
FloorItem item = new FloorItem(true);
                                                                
item.ItemID 1397;
                                                                
item.MapID attacker.MapID;
                                                                
item.Type FloorItem.Effect;
                                                                
item.= (ushort)a.X;
                                                                
item.= (ushort)a.Y;
                                                                
item.OnFloor Time32.Now;
                                                                
item.Owner attacker.Owner;
                                                                
item.UID FloorItem.FloorUID.Next;
                                                                while (
attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
                                                                    
item.UID FloorItem.FloorUID.Next;
                                                                
item.mColor 14;
                                                                
item.OwnerUID attacker.UID;
                                                                
item.OwnerGuildUID attacker.GuildID;
                                                                
item.FlowerType 0;
                                                                
item.Timer Kernel.TqTimer(DateTime.Now.AddSeconds(3));
                                                                
item.Name "InfernalEcho";
                                                                
attacker.Owner.SendScreenSpawn(itemtrue);
                                                                
attacker.AttackPacket null;
                                                            }
                                                        }
                                                        break;
                                                    }
                                                
#endregion
                                                #region case 6
                                                
case 6:
                                                    {
                                                        var 
area2 GetLocation(attacker.Xattacker.Y);
                                                        
int count 4;
                                                        List<
System.Drawing.PointArea = new List<Point>();
                                                        for (
int i 0360+= spell.Sector)
                                                        {
                                                            if (
Area.Count >= count)
                                                            {
                                                                break;
                                                            }
                                                            
int r i;
                                                            var 
distance Kernel.Random.Next(spell.Rangespell.Distance);
                                                            var 
x2 = (ushort)(+ (distance Math.Cos(r)));
                                                            var 
y2 = (ushort)(+ (distance Math.Sin(r)));
                                                            
System.Drawing.Point point = new System.Drawing.Point((int)x2, (int)y2);
                                                            if (!
Area.Contains(point))
                                                            {
                                                                
Area.Add(point);
                                                            }
                                                            else
                                                            {
                                                                
i--;
                                                            }
                                                        }
                                                        if (
Nr == 1)
                                                        {
                                                            foreach (var 
a in area2)
                                                            {
                                                                
FloorItem item = new FloorItem(true);
                                                                
item.ItemID 1397;
                                                                
item.MapID attacker.MapID;
                                                                
item.Type FloorItem.Effect;
                                                                
item.= (ushort)a.X;
                                                                
item.= (ushort)a.Y;
                                                                
item.OnFloor Time32.Now;
                                                                
item.Owner attacker.Owner;
                                                                
item.UID FloorItem.FloorUID.Next;
                                                                while (
attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
                                                                    
item.UID FloorItem.FloorUID.Next;
                                                                
item.mColor 14;
                                                                
item.OwnerUID attacker.UID;
                                                                
item.OwnerGuildUID attacker.GuildID;
                                                                
item.FlowerType 0;
                                                                
item.Timer Kernel.TqTimer(DateTime.Now.AddSeconds(3));
                                                                
item.Name "InfernalEcho";
                                                                
attacker.Owner.SendScreenSpawn(itemtrue);
                                                                
attacker.AttackPacket null;

                                                            }
                                                        }
                                                        else if (
Nr == 2)
                                                        {
                                                            foreach (var 
a in Area)
                                                            {
                                                                
FloorItem item = new FloorItem(true);
                                                                
item.ItemID 1397;
                                                                
item.MapID attacker.MapID;
                                                                
item.Type FloorItem.Effect;
                                                                
item.= (ushort)a.X;
                                                                
item.= (ushort)a.Y;
                                                                
item.OnFloor Time32.Now;
                                                                
item.Owner attacker.Owner;
                                                                
item.UID FloorItem.FloorUID.Next;
                                                                while (
attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
                                                                    
item.UID FloorItem.FloorUID.Next;
                                                                
item.mColor 14;
                                                                
item.OwnerUID attacker.UID;
                                                                
item.OwnerGuildUID attacker.GuildID;
                                                                
item.FlowerType 0;
                                                                
item.Timer Kernel.TqTimer(DateTime.Now.AddSeconds(3));
                                                                
item.Name "InfernalEcho";
                                                                
attacker.Owner.SendScreenSpawn(itemtrue);
                                                                
attacker.AttackPacket null;
                                                            }
                                                        }
                                                        else if (
Nr == 3)
                                                        {
                                                            foreach (var 
a in Area)
                                                            {
                                                                
FloorItem item = new FloorItem(true);
                                                                
item.ItemID 1397;
                                                                
item.MapID attacker.MapID;
                                                                
item.Type FloorItem.Effect;
                                                                
item.= (ushort)a.X;
                                                                
item.= (ushort)a.Y;
                                                                
item.OnFloor Time32.Now;
                                                                
item.Owner attacker.Owner;
                                                                
item.UID FloorItem.FloorUID.Next;
                                                                while (
attacker.Owner.Map.FloorItems.ContainsKey(item.UID))
                                                                    
item.UID FloorItem.FloorUID.Next;
                                                                
item.mColor 14;
                                                                
item.OwnerUID attacker.UID;
                                                                
item.OwnerGuildUID attacker.GuildID;
                                                                
item.FlowerType 0;
                                                                
item.Timer Kernel.TqTimer(DateTime.Now.AddSeconds(3));
                                                                
item.Name "InfernalEcho";
                                                                
attacker.Owner.SendScreenSpawn(itemtrue);
                                                                
attacker.AttackPacket null;
                                                            }
                                                        }
                                                        break;
                                                    }
                                                
#endregion
                                            
}
                                        }
                                        break;
                                    }
                                
#endregion

                                #region WrathoftheEmperor
                                
case 12570:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;
                                            
suse.SpellEffect 1;
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null) continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= 2)
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Ranged))
                                                        {
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                            {
                                                                
damage = (uint)(damage 0.7);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                            {
                                                                
damage = (uint)(damage 0.7);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                            {
                                                                
damage = (uint)(damage 0.7);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                            {
                                                                
damage = (uint)(damage 0.5);
                                                            }
                                                            
suse.Effect1 attack.Effect1;
                                                            
ReceiveAttack(attackerattackedattackref damagespell);
                                                            
attacked.Stunned true;
                                                            
attacked.StunStamp Time32.Now;
                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
attackedsob _obj as SobNpcSpawn;
                                                    if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= 2)
                                                    {
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {

                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                            
suse.Effect1 attack.Effect1;
                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region GraceofHeaven
                                
case 12560:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
SpellID 10425;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
attacker.Stamina += (byte)spell.Power;
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null) continue;
                                                if (
_obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= 12)
                                                    {
                                                        
int R Kernel.Random.Next(110);
                                                        if (
!= 4) continue;
                                                        if (
attacked.ContainsFlag2((ulong)Update.Flags2.SoulShackle))
                                                        {

                                                            
suse.AddTarget(attacked0attack);

                                                            
attacked.RemoveFlag2((ulong)Update.Flags2.SoulShackle);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.IncreaseSpellExperience(1012560);
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Riding
                                
case 7001:
                                    {
                                        if (
attacker.Owner.Map.ID == 1081 || attacker.Owner.Map.ID == 4444 || attacker.Owner.Map.ID == 1707 || attacker.Owner.Map.ID == 2233 || attacker.Owner.Map.ID == 9898 || attacker.Owner.Map.ID == 2233 || attacker.Owner.Map.ID == 16414 || attacker.Owner.Map.ID == 3691 || attacker.Owner.Map.ID == 3692 || attacker.Owner.Map.ID == 3693 || attacker.Owner.Map.ID == 3694 || attacker.Owner.Map.ID == 44444 || attacker.Owner.Map.ID == 2222 || attacker.Owner.Map.ID == 8899 || attacker.Owner.Map.ID == 1365 || attacker.Owner.Map.ID == 1366)
                                        {
                                            
Kernel.SendWorldMessage(new Message("Mr: " attacker.Name " You Can`t Use Riding Here !!!"System.Drawing.Color.WhiteMessage.Talk), Program.Values);
                                            return;
                                        }
                                        if (
attacker.Owner.Map.ID == 1507 || attacker.Owner.Map.ID == 881 || attacker.Owner.Map.ID == 882 || attacker.Owner.Map.ID == 883 || attacker.Owner.Map.ID == 884 || attacker.Owner.Map.ID == 1238 || attacker.Owner.Map.ID == 1459 || attacker.Owner.Map.ID == 1458 || attacker.Owner.Map.ID == 1460)
                                        {
                                            
Kernel.SendWorldMessage(new Message("Mr: " attacker.Name " You Can`t Use Riding Here !!!"System.Drawing.Color.WhiteMessage.Talk), Program.Values);
                                            return;
                                        }
                                        if (
attacker.ContainsFlag(Update.Flags.ShurikenVortex))
                                            return;
                                        if (!
attacker.Owner.Equipment.Free(12))
                                        {
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
UInt16 oxoy;
                                            
ox attacker.X;
                                            
oy attacker.Y;
                                            if (
attacker.ContainsFlag(Update.Flags.Ride))
                                            {
                                                
attacker.RemoveFlag(Update.Flags.Ride);
                                            }
                                            else
                                            {
                                                if (
attacker.Owner.Map.ID == 1036 && attacker.Owner.Equipment.TryGetItem((byte)12).Plus 6)
                                                    break;
                                                if (
attacker.Owner.Map.BaseID == 700)
                                                    break;
                                                if (
attacker.Stamina >= 1)
                                                {
                                                    
attacker.AddFlag(Update.Flags.Ride);
                                                    
attacker.Stamina -= 1;
                                                    
attacker.Vigor = (ushort)(attacker.Owner.MaxVigor 2);
                                                    
Network.GamePackets.Vigor vigor = new Network.GamePackets.Vigor(true);
                                                    
vigor.Amount attacker.Owner.Vigor;
                                                    
vigor.Send(attacker.Owner);
                                                }
                                            }
                                            
suse.AddTarget(attacker0attack);
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                case 
7002:
                                    {
//Spook
                                        
if (attacked.ContainsFlag(Update.Flags.Ride) && attacker.ContainsFlag(Update.Flags.Ride))
                                        {
                                            
ConquerItem attackedSteed nullattackerSteed null;
                                            if ((
attackedSteed attacked.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null)
                                            {
                                                if ((
attackerSteed attacker.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null)
                                                {
                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;
                                                    
suse.AddTarget(attacked0attack);
                                                    if (
attackedSteed.Plus attackerSteed.Plus)
                                                        
attacked.RemoveFlag(Update.Flags.Ride);
                                                    else if (
attackedSteed.Plus == attackerSteed.Plus && attackedSteed.PlusProgress <= attackerSteed.PlusProgress)
                                                        
attacked.RemoveFlag(Update.Flags.Ride);
                                                    else
                                                        
suse.Targets[attacked.UID].Hit false;
                                                    
attacker.Owner.SendScreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                case 
7003:
                                    {
//WarCry
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.X;
                                        
suse.Y;
                                        
ConquerItem attackedSteed nullattackerSteed null;
                                        foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                        {
                                            if (
_obj == null)
                                                continue;
                                            if (
_obj.MapObjType == MapObjectType.Entity && _obj.UID != attacker.UID)
                                            {
                                                
attacked _obj as Entity;
                                                if ((
attackedSteed attacked.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null)
                                                {
                                                    if ((
attackerSteed attacker.Owner.Equipment.TryGetItem(ConquerItem.Steed)) != null)
                                                    {
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= attackedSteed.Plus)
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
suse.AddTarget(attacked0attack);
                                                                if (
attackedSteed.Plus attackerSteed.Plus)
                                                                    
attacked.RemoveFlag(Update.Flags.Ride);
                                                                else if (
attackedSteed.Plus == attackerSteed.Plus && attackedSteed.PlusProgress <= attackerSteed.PlusProgress)
                                                                    
attacked.RemoveFlag(Update.Flags.Ride);
                                                                else
                                                                    
suse.Targets[attacked.UID].Hit false;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.Owner.SendScreen(susetrue);
                                        break;
                                    }
                                
#endregion

                                #region Dash
                                
case 1051:
                                    {
                                        if (
attacked != null)
                                        {
                                            if (!
attacked.Dead)
                                            {
                                                var 
direction Kernel.GetAngle(attacker.Xattacker.Yattacked.Xattacked.Y);
                                                if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                {
                                                    
attack = new Attack(true);
                                                    
attack.Effect1 Attack.AttackEffects1.None;
                                                    
uint damage Calculate.Melee(attackerattackedref attack);
                                                    
attack.AttackType Attack.Dash;
                                                    
attack.attacked.X;
                                                    
attack.attacked.Y;
                                                    
attack.Attacker attacker.UID;
                                                    
attack.Attacked attacked.UID;
                                                    
attack.Damage damage;
                                                    
attack.ToArray()[27] = (byte)direction;
                                                    
attacked.Move(direction);
                                                    
attacker.Move(direction);

                                                    
ReceiveAttack(attackerattackedattackref damagespell);

                                                    
attacker.Owner.SendScreen(attacktrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion

                                #region RapidFire
                                
case 8000:
                                    {
                                        if (
attackedsob != null)
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                if (
CanAttack(attackerattackedsobspell))
                                                {
                                                    
PrepareSpell(spellattacker.Owner);
                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.attackedsob.X;
                                                    
suse.attackedsob.Y;
                                                    
attack.Effect1 Attack.AttackEffects1.None;
                                                    
uint damage Calculate.Ranged(attackerattackedsobref attack);
                                                    
suse.Effect1 attack.Effect1;
                                                    
suse.AddTarget(attackedsobdamageattack);

                                                    
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                    
attacker.Owner.SendScreen(susetrue);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (!
attacked.Dead)
                                            {
                                                if (
CanUseSpell(spellattacker.Owner))
                                                {
                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        
SpellUse suse = new SpellUse(true);
                                                        
suse.Attacker attacker.UID;
                                                        
suse.SpellID spell.ID;
                                                        
suse.SpellLevel spell.Level;
                                                        
suse.attacked.X;
                                                        
suse.attacked.Y;
                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Calculate.Ranged(attackerattackedref attack);
                                                        
suse.AddTarget(attackeddamageattack);

                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
attacker.Owner.SendScreen(susetrue);
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion

                                #region FireOfHell
                                
case 1165:
                                case 
7014:
                                case 
7017:
                                case 
7015:
                                case 
7011:
                                case 
7012:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
suse.Y;
                                            
Sector sector = new Sector(attacker.Xattacker.YXY);
                                            
sector.Arrange(spell.Sectorspell.Distance);
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;

                                                    if (
sector.Inside(attacked.Xattacked.Y))
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Magic(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                            
suse.Effect1 attack.Effect1;

                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);

                                                            if (
spell.ID == 1165)
                                                            {
                                                                if (
attacked.EntityFlag == EntityFlag.Entity)
                                                                {
                                                                    
#region BreakingTouch
                                                                    
attacked.Owner.BreakTouch(attacker.Owner);
                                                                    
#endregion
                                                                
}
                                                            }

                                                        }
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
attackedsob _obj as SobNpcSpawn;

                                                    if (
sector.Inside(attackedsob.Xattackedsob.Y))
                                                    {
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Magic(attackerattackedsobspellref attack);
                                                            
suse.Effect1 attack.Effect1;
                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Scatter
                                
case 8001:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
Sector sector = new Sector(attacker.Xattacker.YXY);
                                            
sector.Arrange(spell.Sectorspell.Distance);
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;

                                                    if (
sector.Inside(attacked.Xattacked.Y))
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Ranged(attackerattackedspellref attack);

                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
attackedsob _obj as SobNpcSpawn;

                                                    if (
sector.Inside(attackedsob.Xattackedsob.Y))
                                                    {
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Ranged(attackerattackedsobref attack);
                                                            
suse.Effect1 attack.Effect1;
                                                            if (
damage == 0)
                                                                
damage 1;
                                                            
damage Game.Attacking.Calculate.Percent((int)damagespell.PowerPercent);

                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region StarArrow
                                
case 10313:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
if (attacked != null)
                                            {
                                                if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                {
                                                    
ushort _X attacked.X_Y attacked.Y;
                                                    
byte dist 5;
                                                    var 
angle Kernel.GetAngle(attacker.Xattacker.Yattacked.Xattacked.Y);
                                                    while (
dist != 0)
                                                    {
                                                        if (
attacked.fMove(angleref _Xref _Y))
                                                        {
                                                            
_X;
                                                            
_Y;
                                                        }
                                                        else break;
                                                        
dist--;
                                                    }
                                                    
suse.attacked.X;
                                                    
suse.attacked.Y;
                                                    
attack.Effect1 Attack.AttackEffects1.None;
                                                    
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                    
ReceiveAttack(attackerattackedattackref damagespell);

                                                    
suse.AddTarget(attackeddamageattack);
                                                }
                                            }
                                            else if (
attackedsob != null)
                                            {
                                                if (
CanAttack(attackerattackedsobspell))
                                                {
                                                    
suse.attackedsob.X;
                                                    
suse.attackedsob.Y;
                                                    
attack.Effect1 Attack.AttackEffects1.None;
                                                    
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                    
suse.Effect1 attack.Effect1;
                                                    if (
damage == 0)
                                                        
damage 1;
                                                    
damage Game.Attacking.Calculate.Percent((int)damagespell.PowerPercent);

                                                    
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                    
suse.AddTarget(attackedsobdamageattack);
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Trasnformations
                                
case 1270:
                                case 
1280:
                                case 
1350:
                                case 
1360:
                                case 
3321:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (
attacker.MapID == 1036)
                                                return;
                                            if (
attacker.MapID == 1950)
                                                return;
                                            
bool wasTransformated attacker.Transformed;
                                            
PrepareSpell(spellattacker.Owner);

                                            
#region Atributes
                                            
switch (spell.ID)
                                            {
                                                case 
3321://GM skill
                                                    
{
                                                        
attacker.TransformationMaxAttack 2000000;
                                                        
attacker.TransformationMinAttack 2000000;
                                                        
attacker.TransformationDefence 65355;
                                                        
attacker.TransformationMagicDefence 65355;
                                                        
attacker.TransformationDodge 35;
                                                        
attacker.TransformationTime 65355;
                                                        
attacker.TransformationID 223;
                                                        
attacker.Hitpoints attacker.MaxHitpoints;
                                                        
attacker.Mana attacker.MaxMana;
                                                        break;
                                                    }
                                                case 
1350:
                                                    switch (
spell.Level)
                                                    {
                                                        case 
0:
                                                            {
                                                                
attacker.TransformationMaxAttack 182;
                                                                
attacker.TransformationMinAttack 122;
                                                                
attacker.TransformationDefence 1300;
                                                                
attacker.TransformationMagicDefence 94;
                                                                
attacker.TransformationDodge 35;
                                                                
attacker.TransformationTime 39;
                                                                
attacker.TransformationID 207;
                                                                break;
                                                            }
                                                        case 
1:
                                                            {
                                                                
attacker.TransformationMaxAttack 200;
                                                                
attacker.TransformationMinAttack 134;
                                                                
attacker.TransformationDefence 1400;
                                                                
attacker.TransformationMagicDefence 96;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 49;
                                                                
attacker.TransformationID 207;
                                                                break;
                                                            }
                                                        case 
2:
                                                            {
                                                                
attacker.TransformationMaxAttack 240;
                                                                
attacker.TransformationMinAttack 160;
                                                                
attacker.TransformationDefence 1500;
                                                                
attacker.TransformationMagicDefence 97;
                                                                
attacker.TransformationDodge 45;
                                                                
attacker.TransformationTime 59;
                                                                
attacker.TransformationID 207;
                                                                break;
                                                            }
                                                        case 
3:
                                                            {
                                                                
attacker.TransformationMaxAttack 258;
                                                                
attacker.TransformationMinAttack 172;
                                                                
attacker.TransformationDefence 1600;
                                                                
attacker.TransformationMagicDefence 98;
                                                                
attacker.TransformationDodge 50;
                                                                
attacker.TransformationTime 69;
                                                                
attacker.TransformationID 267;
                                                                break;
                                                            }
                                                        case 
4:
                                                            {
                                                                
attacker.TransformationMaxAttack 300;
                                                                
attacker.TransformationMinAttack 200;
                                                                
attacker.TransformationDefence 1900;
                                                                
attacker.TransformationMagicDefence 99;
                                                                
attacker.TransformationDodge 55;
                                                                
attacker.TransformationTime 79;
                                                                
attacker.TransformationID 267;
                                                                break;
                                                            }
                                                    }
                                                    break;
                                                case 
1270:
                                                    switch (
spell.Level)
                                                    {
                                                        case 
0:
                                                            {
                                                                
attacker.TransformationMaxAttack 282;
                                                                
attacker.TransformationMinAttack 179;
                                                                
attacker.TransformationDefence 73;
                                                                
attacker.TransformationMagicDefence 34;
                                                                
attacker.TransformationDodge 9;
                                                                
attacker.TransformationTime 34;
                                                                
attacker.TransformationID 214;
                                                                break;
                                                            }
                                                        case 
1:
                                                            {
                                                                
attacker.TransformationMaxAttack 395;
                                                                
attacker.TransformationMinAttack 245;
                                                                
attacker.TransformationDefence 126;
                                                                
attacker.TransformationMagicDefence 45;
                                                                
attacker.TransformationDodge 12;
                                                                
attacker.TransformationTime 39;
                                                                
attacker.TransformationID 214;
                                                                break;
                                                            }
                                                        case 
2:
                                                            {
                                                                
attacker.TransformationMaxAttack 616;
                                                                
attacker.TransformationMinAttack 367;
                                                                
attacker.TransformationDefence 180;
                                                                
attacker.TransformationMagicDefence 53;
                                                                
attacker.TransformationDodge 15;
                                                                
attacker.TransformationTime 44;
                                                                
attacker.TransformationID 214;
                                                                break;
                                                            }
                                                        case 
3:
                                                            {
                                                                
attacker.TransformationMaxAttack 724;
                                                                
attacker.TransformationMinAttack 429;
                                                                
attacker.TransformationDefence 247;
                                                                
attacker.TransformationMagicDefence 53;
                                                                
attacker.TransformationDodge 15;
                                                                
attacker.TransformationTime 49;
                                                                
attacker.TransformationID 214;
                                                                break;
                                                            }
                                                        case 
4:
                                                            {
                                                                
attacker.TransformationMaxAttack 1231;
                                                                
attacker.TransformationMinAttack 704;
                                                                
attacker.TransformationDefence 499;
                                                                
attacker.TransformationMagicDefence 50;
                                                                
attacker.TransformationDodge 20;
                                                                
attacker.TransformationTime 54;
                                                                
attacker.TransformationID 274;
                                                                break;
                                                            }
                                                        case 
5:
                                                            {
                                                                
attacker.TransformationMaxAttack 1573;
                                                                
attacker.TransformationMinAttack 941;
                                                                
attacker.TransformationDefence 601;
                                                                
attacker.TransformationMagicDefence 53;
                                                                
attacker.TransformationDodge 25;
                                                                
attacker.TransformationTime 59;
                                                                
attacker.TransformationID 274;
                                                                break;
                                                            }
                                                        case 
6:
                                                            {
                                                                
attacker.TransformationMaxAttack 1991;
                                                                
attacker.TransformationMinAttack 1107;
                                                                
attacker.TransformationDefence 1029;
                                                                
attacker.TransformationMagicDefence 55;
                                                                
attacker.TransformationDodge 30;
                                                                
attacker.TransformationTime 64;
                                                                
attacker.TransformationID 274;
                                                                break;
                                                            }
                                                        case 
7:
                                                            {
                                                                
attacker.TransformationMaxAttack 2226;
                                                                
attacker.TransformationMinAttack 1235;
                                                                
attacker.TransformationDefence 1029;
                                                                
attacker.TransformationMagicDefence 55;
                                                                
attacker.TransformationDodge 35;
                                                                
attacker.TransformationTime 69;
                                                                
attacker.TransformationID 274;
                                                                break;
                                                            }
                                                    }
                                                    break;
                                                case 
1360:
                                                    switch (
spell.Level)
                                                    {
                                                        case 
0:
                                                            {
                                                                
attacker.TransformationMaxAttack 1215;
                                                                
attacker.TransformationMinAttack 610;
                                                                
attacker.TransformationDefence 100;
                                                                
attacker.TransformationMagicDefence 96;
                                                                
attacker.TransformationDodge 30;
                                                                
attacker.TransformationTime 59;
                                                                
attacker.TransformationID 217;
                                                                break;
                                                            }
                                                        case 
1:
                                                            {
                                                                
attacker.TransformationMaxAttack 1310;
                                                                
attacker.TransformationMinAttack 650;
                                                                
attacker.TransformationDefence 400;
                                                                
attacker.TransformationMagicDefence 97;
                                                                
attacker.TransformationDodge 30;
                                                                
attacker.TransformationTime 79;
                                                                
attacker.TransformationID 217;
                                                                break;
                                                            }
                                                        case 
2:
                                                            {
                                                                
attacker.TransformationMaxAttack 1420;
                                                                
attacker.TransformationMinAttack 710;
                                                                
attacker.TransformationDefence 650;
                                                                
attacker.TransformationMagicDefence 98;
                                                                
attacker.TransformationDodge 30;
                                                                
attacker.TransformationTime 89;
                                                                
attacker.TransformationID 217;
                                                                break;
                                                            }
                                                        case 
3:
                                                            {
                                                                
attacker.TransformationMaxAttack 1555;
                                                                
attacker.TransformationMinAttack 780;
                                                                
attacker.TransformationDefence 720;
                                                                
attacker.TransformationMagicDefence 98;
                                                                
attacker.TransformationDodge 30;
                                                                
attacker.TransformationTime 99;
                                                                
attacker.TransformationID 277;
                                                                break;
                                                            }
                                                        case 
4:
                                                            {
                                                                
attacker.TransformationMaxAttack 1660;
                                                                
attacker.TransformationMinAttack 840;
                                                                
attacker.TransformationDefence 1200;
                                                                
attacker.TransformationMagicDefence 99;
                                                                
attacker.TransformationDodge 30;
                                                                
attacker.TransformationTime 109;
                                                                
attacker.TransformationID 277;
                                                                break;
                                                            }
                                                    }
                                                    break;
                                                case 
1280:
                                                    switch (
spell.Level)
                                                    {
                                                        case 
0:
                                                            {
                                                                
attacker.TransformationMaxAttack 930;
                                                                
attacker.TransformationMinAttack 656;
                                                                
attacker.TransformationDefence 290;
                                                                
attacker.TransformationMagicDefence 45;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 29;
                                                                
attacker.TransformationID 213;
                                                                break;
                                                            }
                                                        case 
1:
                                                            {
                                                                
attacker.TransformationMaxAttack 1062;
                                                                
attacker.TransformationMinAttack 750;
                                                                
attacker.TransformationDefence 320;
                                                                
attacker.TransformationMagicDefence 46;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 34;
                                                                
attacker.TransformationID 213;
                                                                break;
                                                            }
                                                        case 
2:
                                                            {
                                                                
attacker.TransformationMaxAttack 1292;
                                                                
attacker.TransformationMinAttack 910;
                                                                
attacker.TransformationDefence 510;
                                                                
attacker.TransformationMagicDefence 50;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 39;
                                                                
attacker.TransformationID 213;
                                                                break;
                                                            }
                                                        case 
3:
                                                            {
                                                                
attacker.TransformationMaxAttack 1428;
                                                                
attacker.TransformationMinAttack 1000;
                                                                
attacker.TransformationDefence 600;
                                                                
attacker.TransformationMagicDefence 53;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 44;
                                                                
attacker.TransformationID 213;
                                                                break;
                                                            }
                                                        case 
4:
                                                            {
                                                                
attacker.TransformationMaxAttack 1570;
                                                                
attacker.TransformationMinAttack 1100;
                                                                
attacker.TransformationDefence 700;
                                                                
attacker.TransformationMagicDefence 55;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 49;
                                                                
attacker.TransformationID 213;
                                                                break;
                                                            }
                                                        case 
5:
                                                            {
                                                                
attacker.TransformationMaxAttack 1700;
                                                                
attacker.TransformationMinAttack 1200;
                                                                
attacker.TransformationDefence 880;
                                                                
attacker.TransformationMagicDefence 57;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 54;
                                                                
attacker.TransformationID 273;
                                                                break;
                                                            }
                                                        case 
6:
                                                            {
                                                                
attacker.TransformationMaxAttack 1900;
                                                                
attacker.TransformationMinAttack 1300;
                                                                
attacker.TransformationDefence 1540;
                                                                
attacker.TransformationMagicDefence 59;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 59;
                                                                
attacker.TransformationID 273;
                                                                break;
                                                            }
                                                        case 
7:
                                                            {
                                                                
attacker.TransformationMaxAttack 2100;
                                                                
attacker.TransformationMinAttack 1500;
                                                                
attacker.TransformationDefence 1880;
                                                                
attacker.TransformationMagicDefence 61;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 59;
                                                                
attacker.TransformationID 273;
                                                                break;
                                                            }
                                                        case 
8:
                                                            {
                                                                
attacker.TransformationMaxAttack 2300;
                                                                
attacker.TransformationMinAttack 1600;
                                                                
attacker.TransformationDefence 1970;
                                                                
attacker.TransformationMagicDefence 63;
                                                                
attacker.TransformationDodge 40;
                                                                
attacker.TransformationTime 59;
                                                                
attacker.TransformationID 273;
                                                                break;
                                                            }
                                                    }
                                                    break;

                                            }
                                            
#endregion

                                            
SpellUse spellUse = new SpellUse(true);
                                            
spellUse.Attacker attacker.UID;
                                            
spellUse.SpellID spell.ID;
                                            
spellUse.SpellLevel spell.Level;
                                            
spellUse.X;
                                            
spellUse.Y;
                                            
spellUse.AddTarget(attacker, (uint)0attack);
                                            
attacker.Owner.SendScreen(spellUsetrue);
                                            
attacker.TransformationStamp Time32.Now;
                                            
attacker.TransformationMaxHP 3000;
                                            if (
spell.ID == 1270)
                                                
attacker.TransformationMaxHP 50000;
                                            
attacker.TransformationAttackRange 3;
                                            if (
spell.ID == 1360)
                                                
attacker.TransformationAttackRange 10;
                                            if (!
wasTransformated)
                                            {
                                                
double maxHP attacker.MaxHitpoints;
                                                
double HP attacker.Hitpoints;
                                                
double point HP maxHP;

                                                
attacker.Hitpoints = (uint)(attacker.TransformationMaxHP point);
                                            }
                                            
attacker.Update(Update.MaxHitpointsattacker.TransformationMaxHPfalse);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Bless
                                
case 9876:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
attacker.AddFlag(Update.Flags.CastPray);
                                            
SpellUse spellUse = new SpellUse(true);
                                            
spellUse.Attacker attacker.UID;
                                            
spellUse.SpellID spell.ID;
                                            
spellUse.SpellLevel spell.Level;
                                            
spellUse.X;
                                            
spellUse.Y;
                                            
spellUse.AddTarget(attacker0attack);
                                            
attacker.Owner.SendScreen(spellUsetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Companions
                                
case 4000:
                                case 
4010:
                                case 
4020:
                                case 
4050:
                                case 
4060:
                                case 
4070:
                                case 
12020:
                                case 
12030:
                                case 
12040:
                                case 
12610:
                                case 
12050:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {

                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse spellUse = new SpellUse(true);
                                            
spellUse.Attacker attacker.UID;
                                            
spellUse.SpellID spell.ID;
                                            
spellUse.SpellLevel spell.Level;
                                            
spellUse.X;
                                            
spellUse.Y;
                                            
spellUse.AddTarget(attacker0attack);
                                            
attacker.Owner.SendScreen(spellUsetrue);
                                            
MonsterInformation information5 null;
                                            if (
MonsterInformation.MonsterInformations.TryGetValue(spell.Powerout information5))
                                                
attacker.Owner.Pet.AddPet(information5);


                                        }
                                        break;
                                    }
                                
#endregion

                                #region MonkSpells
                                #region Auras

                                
case 10424:
                                case 
10423:
                                case 
10422:
                                case 
10421:
                                case 
10420:
                                
//Tyrant Aura
                                
case 10395:
                                
//Fend Aura
                                
case 10410:
                                    {
                                        
HandleAura(attackerspell);
                                    }
                                    break;
                                
#endregion
                                #region Compassion
                                
case 10430:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;

                                            if (
attacker.Owner.Team != null)
                                            {
                                                
PrepareSpell(spellattacker.Owner);
                                                foreach (
Client.GameState teammate in attacker.Owner.Team.Teammates)
                                                {
                                                    if (
Kernel.GetDistance(attacker.Xattacker.Yteammate.Player.Xteammate.Player.Y) <= spell.Distance)
                                                    {
                                                        
teammate.Player.RemoveFlag(Update.Flags.Poisoned);

                                                        
suse.AddTarget(teammate.Player0attack);
                                                    }
                                                }
                                                
attacker.Owner.SendScreen(susetrue);
                                            }
                                            else
                                            {
                                                
PrepareSpell(spellattacker.Owner);

                                                
attacker.RemoveFlag(Update.Flags.Poisoned);

                                                
suse.AddTarget(attacker0attack);

                                                if (
attacked.EntityFlag == EntityFlag.Entity)
                                                    
attacked.Owner.SendScreen(susetrue);
                                                else
                                                    
attacker.Owner.SendScreen(susetrue);
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Serenity
                                
case 10400:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            if (
attacker == null) return;

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;

                                            
suse.AddTarget(attacker0attack);
                                            
attacked.ToxicFogLeft 0;
                                            
attacked.NoDrugsTime 0;
                                            
attacked.RemoveFlag2(Update.Flags2.SoulShackle);
                                            
attacked.RemoveFlag2(Update.Flags2.EffectBall);
                                            
attacked.lianhuaranLeft 0;
                                            
//                                            attacked.Owner.Send(new GameCharacterUpdates(true) { UID = attacked.UID, }
                                            //                                                        .Remove(GameCharacterUpdates.SoulShacle));
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                
case 10425:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
//if (attacker.EpicMonk())
                                            
{


                                                
PrepareSpell(spellattacker.Owner);

                                                if (
attacked == null) return;

                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID// Mr.Lover __!__ For Other :D 
                                                
suse.SpellID SpellID;
                                                
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                                
suse.X;
                                                
suse.Y;


                                                
suse.AddTarget(attacked0attack);

                                                
attacked.ToxicFogLeft 0;
                                                
attacked.RemoveFlag2(Update.Flags2.SoulShackle);

                                                
Network.GamePackets.Update upgrade = new Network.GamePackets.Update(true);
                                                
upgrade.UID attacked.UID;
                                                
upgrade.Append(Network.GamePackets.Update.SoulShackle
                                                    
111// Mr.Lover __!__ For Other :D 
                                                    
00spell.Level);
                                                if (
attacked.EntityFlag == EntityFlag.Entity)
                                                    
attacked.Owner.Send(upgrade.ToArray());

                                                
attacked.RemoveFlag2(Update.Flags2.Congelado);
                                                
attacked.RemoveFlag2(Update.Flags2.EffectBall);
                                                
// attacked.lianhuaranLeft1 = 0; 


                                                
attacked.NoDrugsTime 0;// Mr.Lover __!__ For Other :D 
                                                
if (attacked.EntityFlag == EntityFlag.Entity)
                                                    
attacked.Owner.SendScreen(susetrue);
                                                else
                                                    
attacker.Owner.SendScreen(susetrue);// Mr.Lover __!__ For Other :D 


                                            
}
                                            break;

                                        }
                                        break;
                                    }
                                
#region WhirlwindKick
                                
case 10415:
                                    {
                                        if (
Time32.Now attacker.SpellStamp.AddMilliseconds(300))
                                        {
                                            
attacker.AttackPacket null; return;
                                        }
                                        if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= 400)
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);

                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
suse.SpellLevel 0;
                                                
suse.= (ushort)Kernel.Random.Next(310);
                                                
suse.0;
                                                
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                                
if (Kernel.GetDistance(attacker.Xattacker.YXY) <= 500)
                                                {
                                                    for (
int c 0attacker.Owner.Screen.Objects.Lengthc++)
                                                    {
                                                        
//For a multi threaded application, while we go through the collection
                                                        //the collection might change. We will make sure that we wont go off  
                                                        //the limits with a check.
                                                        
if (>= attacker.Owner.Screen.Objects.Length)
                                                            break;
                                                        
Interfaces.IMapObject _obj attacker.Owner.Screen.Objects[c];
                                                        if (
_obj == null)
                                                            continue;
                                                        if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                        {
                                                            
attacked _obj as Entity;
                                                            if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                            {
                                                                if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Ranged))
                                                                {
                                                                    
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                    {
                                                                        
damage = (uint)(damage 0.550);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                    {
                                                                        
damage = (uint)(damage 0.550);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                    {
                                                                        
damage = (uint)(damage 0.530);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                                    {
                                                                        
damage = (uint)(damage 0.500);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
                                                                    {
                                                                        
damage = (uint)(damage 0.4900);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
                                                                    {
                                                                        
damage = (uint)(damage 0.450);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                                    {
                                                                        
damage = (uint)(damage 0.450);
                                                                    }
                                                                    
suse.Effect1 attack.Effect1;
                                                                    
ReceiveAttack(attackerattackedattackref damagespell);
                                                                    
attacked.Stunned true;
                                                                    
attacked.StunStamp Time32.Now;
                                                                    
suse.AddTarget(attackeddamageattack);

                                                                }
                                                            }
                                                        }
                                                    }
                                                    
attacker.AttackPacket null;
                                                }
                                                else
                                                {
                                                    
attacker.AttackPacket null; return;
                                                }
                                                
attacker.Owner.SendScreen(susetrue);
                                                
attacker.SpellStamp Time32.Now;
                                                
suse.Targets = new SafeDictionary<uintSpellUse.DamageClass>();
                                                
attacker.AttackPacket null; return;
                                            }
                                            
attacker.AttackPacket null;
                                        }
                                        
attacker.AttackPacket null; return;
                                    }
                                
#endregion
                                #endregion

                                #region PirateSpells

                                #region GaleBomb
                                
case 11070:
                                    if (
CanUseSpell(spellattacker.Owner))
                                    {

                                        
PrepareSpell(spellattacker.Owner);
                                        
Map map;
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.X;
                                        
suse.Y;
                                        
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                        
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
                                        
int num 0;

                                        switch (
spell.Level)
                                        {
                                            case 
0:
                                            case 
1:
                                                
num 3;
                                                break;
                                            case 
2:
                                            case 
3:
                                                
num 4;
                                                break;
                                            default:
                                                
num 5;
                                                break;
                                        }
                                        
int i 0;
                                        
Kernel.Maps.TryGetValue(attacker.Owner.Map.BaseIDout map);
                                        foreach (var 
t in attacker.Owner.Screen.Objects)
                                        {
                                            if (
== null)
                                                continue;
                                            if (
t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
                                            {
                                                var 
target as Entity;
                                                if (
Kernel.GetDistance(XYtarget.Xtarget.Y) <= spell.Range)
                                                {
                                                    if (
CanAttack(attackertargetspellfalse))
                                                    {
                                                        
tar.Damage Calculate.Ranged(attackertargetspellref attack);
                                                        
tar.Hit true;
                                                        
tar.newX target.X;
                                                        
tar.newY target.Y;
                                                        
Map.Pushback(ref tar.newXref tar.newYattacker.Facing5);

                                                        if (
map != null)
                                                        {
                                                            if (
map.Floor[tar.newXtar.newYMapObjectType.Entityattacker])
                                                            {
                                                                
target.tar.newX;
                                                                
target.tar.newY;
                                                            }
                                                            else
                                                            {
                                                                
tar.newX target.X;
                                                                
tar.newY target.Y;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (
attacker.Owner.Map.Floor[tar.newXtar.newYMapObjectType.Entityattacker])
                                                            {
                                                                
target.tar.newX;
                                                                
target.tar.newY;
                                                            }
                                                            else
                                                            {
                                                                
target.tar.newX;
                                                                
target.tar.newY;
                                                            }
                                                        }
                                                        
suse.AddTarget(targettarattack);
                                                        
ReceiveAttack(attackertargetattackref tar.Damagespell);

                                                        
i++;
                                                        if (
num) break;
                                                    }
                                                }
                                            }
                                        }

                                        if (
attacker.EntityFlag == EntityFlag.Entity)
                                            
attacker.Owner.SendScreen(susetrue);
                                    }
                                    break;
                                
#endregion

                                #region BladeTempest
                                
case 11110:
                                    {
                                        if (
Time32.Now >= attacker.SpellStamp.AddMilliseconds(400))
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);
                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
// suse.SpellLevelHu = 0;
                                                
suse.SpellLevel spell.Level;
                                                
ushort _X attacker.X_Y attacker.Y;
                                                
ushort _tX X_tY Y;
                                                
byte dist = (byte)spell.Distance;
                                                var Array = 
attacker.Owner.Screen.Objects;
                                                
InLineAlgorithm algo = new InLineAlgorithm(attacker.XXattacker.YYdist,
                                                                                   
InLineAlgorithm.Algorithm.DDA);
                                                
attacker.X;
                                                
attacker.Y;
                                                
int i 0;
                                                for (
0algo.lcoords.Counti++)
                                                {
                                                    if (
attacker.Owner.Map.Floor[algo.lcoords[i].Xalgo.lcoords[i].YMapObjectType.Entity]
                                                        && !
attacker.ThroughGate(algo.lcoords[i].Xalgo.lcoords[i].Y))
                                                    {
                                                        
= (ushort)algo.lcoords[i].X;
                                                        
= (ushort)algo.lcoords[i].Y;
                                                    }
                                                    else
                                                    {
                                                        break;
                                                    }
                                                }
                                                
suse.X;
                                                
suse.Y;
                                                if (!
attacker.Owner.Map.Floor[XYMapObjectType.Entitynull])
                                                    return;
                                                
double disth 2;

                                                foreach (
Interfaces.IMapObject _obj in Array)
                                                {
                                                    
bool hit false;
                                                    for (
int j 0ij++)
                                                        if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                            
hit true;
                                                    if (
hit)
                                                    {
                                                        if (
_obj.MapObjType == MapObjectType.Monster)
                                                        {
                                                            
attacked _obj as Entity;
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                {
                                                                    
damage = (uint)(damage 0.733);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                {
                                                                    
damage = (uint)(damage 0.733);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                {
                                                                    
damage = (uint)(damage 0.722);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                                {
                                                                    
damage = (uint)(damage 0.660);
                                                                }

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
                                                                {
                                                                    
damage = (uint)(damage 0.630);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
                                                                {
                                                                    
damage = (uint)(damage 0.450);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                                {
                                                                    
damage = (uint)(damage 0.450);
                                                                }

                                                                
ReceiveAttack(attackerattackedattackref damagespell);

                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                        else if (
_obj.MapObjType == MapObjectType.Entity)
                                                        {
                                                            
attacked _obj as Entity;
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                {
                                                                    
damage = (uint)(damage 0.780);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                {
                                                                    
damage = (uint)(damage 0.760);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                {
                                                                    
damage = (uint)(damage 0.722);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                                {
                                                                    
damage = (uint)(damage 0.660);
                                                                }

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
                                                                {
                                                                    
damage = (uint)(damage 0.550);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
                                                                {
                                                                    
damage = (uint)(damage 0.450);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                                {
                                                                    
damage = (uint)(damage 0.450);
                                                                }

                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedattackref damagespell);
                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                        else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                        {
                                                            
attackedsob _obj as SobNpcSpawn;
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                {
                                                                    
damage = (uint)(damage 0.770);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                {
                                                                    
damage = (uint)(damage 0.760);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                {
                                                                    
damage = (uint)(damage 0.722);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                                {
                                                                    
damage = (uint)(damage 0.660);
                                                                }

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
                                                                {
                                                                    
damage = (uint)(damage 0.550);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
                                                                {
                                                                    
damage = (uint)(damage 0.450);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                                {
                                                                    
damage = (uint)(damage 0.450);
                                                                }

                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                                
attacker.PX attacker.X;
                                                
attacker.PY attacker.Y;
                                                
attacker.X;
                                                
attacker.Y;
                                                
attacker.Owner.SendScreen(susetrue);
                                                
attacker.Owner.Screen.Reload(suse);
                                            }
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Kraken`sRevenge
                                
case 11100:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {

                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
int num 0;

                                            switch (
spell.Level)
                                            {
                                                case 
0:
                                                case 
1:
                                                    
num 3;
                                                    break;
                                                case 
2:
                                                case 
3:
                                                    
num 4;
                                                    break;
                                                default:
                                                    
num 5;
                                                    break;
                                            }

                                            
int i 0;
                                            
BlackSpotPacket bsp = new BlackSpotPacket();
                                            foreach (var 
t in attacker.Owner.Screen.Objects/*.OrderBy(x => Kernel.GetDistance(x.X, x.Y, attacker.Owner.Entity.X, attacker.Owner.Entity.Y))*/)
                                            {
                                                if (
== null)
                                                    continue;
                                                if (
t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
                                                {
                                                    var 
target as Entity;
                                                    if (
CanAttack(attackertargetspellfalse))
                                                    {
                                                        
target.IsBlackSpotted true;
                                                        
target.BlackSpotStamp Time32.Now;
                                                        
target.BlackSpotStepSecs spell.Duration;
                                                        
Kernel.BlackSpoted.TryAdd(target.UIDtarget);
                                                        
suse.AddTarget(target, new SpellUse.DamageClass(), attack);
                                                        
i++;
                                                        if (
== num) break;
                                                    }
                                                }
                                            }
                                            if (
attacker.EntityFlag == EntityFlag.Entity)
                                                
attacker.Owner.SendScreen(susetrue);

                                            foreach (var 
h in Program.Values)
                                            {
                                                foreach (var 
t in suse.Targets.Keys)
                                                {
                                                    
h.Send(bsp.ToArray(truet));
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion

                                #region ScurvyBomb
                                
case 11040:
                                    if (
CanUseSpell(spellattacker.Owner))
                                    {

                                        
PrepareSpell(spellattacker.Owner);
                                        
Map map;
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.X;
                                        
suse.Y;
                                        
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                        
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
                                        
int num 0;

                                        switch (
spell.Level)
                                        {
                                            case 
0:
                                            case 
1:
                                                
num 3;
                                                break;
                                            case 
2:
                                            case 
3:
                                                
num 4;
                                                break;
                                            default:
                                                
num 5;
                                                break;
                                        }
                                        
int i 0;
                                        
Kernel.Maps.TryGetValue(attacker.Owner.Map.BaseIDout map);
                                        foreach (var 
t in attacker.Owner.Screen.Objects)
                                        {
                                            if (
== null)
                                                continue;
                                            if (
t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
                                            {
                                                var 
target as Entity;
                                                if (
Kernel.GetDistance(XYtarget.Xtarget.Y) <= spell.Range)
                                                {
                                                    if (
CanAttack(attackertargetspellfalse))
                                                    {
                                                        
tar.Damage Calculate.Ranged(attackertargetref attack);
                                                        
tar.Hit true;
                                                        
tar.newX target.X;
                                                        
tar.newY target.Y;
                                                        
Map.Pushback(ref tar.newXref tar.newYattacker.Facing5);

                                                        if (
map != null)
                                                        {
                                                            if (
map.Floor[tar.newXtar.newYMapObjectType.Entityattacker])
                                                            {
                                                                
target.tar.newX;
                                                                
target.tar.newY;
                                                            }
                                                            else
                                                            {
                                                                
tar.newX target.X;
                                                                
tar.newY target.Y;
                                                            }
                                                        }
                                                        else
                                                        {
                                                            if (
attacker.Owner.Map.Floor[tar.newXtar.newYMapObjectType.Entityattacker])
                                                            {
                                                                
target.tar.newX;
                                                                
target.tar.newY;
                                                            }
                                                            else
                                                            {
                                                                
target.tar.newX;
                                                                
target.tar.newY;
                                                            }
                                                        }

                                                        
suse.AddTarget(targettarattack);
                                                        
ReceiveAttack(attackertargetattackref tar.Damagespell);

                                                        
i++;
                                                        if (
num) break;
                                                    }
                                                }
                                            }
                                        }

                                        if (
attacker.EntityFlag == EntityFlag.Entity)
                                            
attacker.Owner.SendScreen(susetrue);
                                    }
                                    break;
                                
#endregion

                                #region Cannon Barrage
                                
case 11050:
                                    {
                                        if (
attacker.Owner.Player.ContainsFlag(Mr_Panda.Network.GamePackets.Update.Flags.XPList))
                                        {
                                            
attacker.Owner.Player.RemoveFlag(Mr_Panda.Network.GamePackets.Update.Flags.XPList);
                                            
attacker.Owner.Player.AddFlag2(Mr_Panda.Network.GamePackets.Update.Flags2.CannonBarrage);
                                            
attacker.Owner.Player.CannonBarrageStamp Time32.Now;
                                            return;
                                        }


                                        
PrepareSpell(spellattacker.Owner);

                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.X;
                                        
suse.Y;
                                        
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                        
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
                                        foreach (var 
t in attacker.Owner.Screen.Objects)
                                        {
                                            if (
== null)
                                                continue;
                                            if (
t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
                                            {
                                                var 
target as Entity;
                                                if (
Kernel.GetDistance(attacker.Owner.Player.Xattacker.Owner.Player.Ytarget.Xtarget.Y) <= spell.Range)
                                                {
                                                    if (
CanAttack(attackertargetspellfalse))
                                                    {
                                                        
tar.Damage Calculate.Ranged(attackertargetref attackclient_Spell.LevelHu2);
                                                        
suse.AddTarget(targettarattack);
                                                        
ReceiveAttack(attackertargetattackref tar.Damagespell);
                                                    }
                                                }
                                            }
                                        }

                                        if (
attacker.EntityFlag == EntityFlag.Entity)
                                            
attacker.Owner.SendScreen(susetrue);

                                        break;
                                    }
                                
#endregion

                                #region Blackbeard`sRage
                                
case 11060:
                                    {
                                        if (
attacker.Owner.Player.ContainsFlag(Mr_Panda.Network.GamePackets.Update.Flags.XPList))
                                        {
                                            
attacker.Owner.Player.RemoveFlag(Mr_Panda.Network.GamePackets.Update.Flags.XPList);
                                            
attacker.Owner.Player.AddFlag2(Mr_Panda.Network.GamePackets.Update.Flags2.BlackbeardsRage);
                                            
attacker.Owner.Player.BlackbeardsRageStamp Time32.Now;
                                            return;
                                        }

                                        
int num 0;
                                        switch (
spell.Level)
                                        {
                                            case 
0:
                                            case 
1:
                                                
num 3;
                                                break;
                                            case 
2:
                                            case 
3:
                                                
num 4;
                                                break;
                                            default:
                                                
num 5;
                                                break;
                                        }
                                        
int i 0;
                                        
PrepareSpell(spellattacker.Owner);

                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.X;
                                        
suse.Y;
                                        
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                        
Mr_Panda.Network.GamePackets.SpellUse.DamageClass tar = new SpellUse.DamageClass();
                                        foreach (var 
t in attacker.Owner.Screen.Objects)
                                        {
                                            if (
== null)
                                                continue;
                                            if (
t.MapObjType == MapObjectType.Entity || t.MapObjType == MapObjectType.Monster)
                                            {
                                                var 
target as Entity;
                                                if (
Kernel.GetDistance(attacker.Owner.Player.Xattacker.Owner.Player.Ytarget.Xtarget.Y) <= spell.Range)
                                                {
                                                    if (
CanAttack(attackertargetspellfalse))
                                                    {
                                                        
tar.Damage Calculate.Ranged(attackertargetref attackclient_Spell.LevelHu2);
                                                        
suse.AddTarget(targettarattack);
                                                        
ReceiveAttack(attackertargetattackref tar.Damagespell);
                                                        
i++;
                                                        if (
== num) break;
                                                    }
                                                }
                                            }
                                        }

                                        if (
attacker.EntityFlag == EntityFlag.Entity)
                                            
attacker.Owner.SendScreen(susetrue);

                                        break;
                                    }
                                
#endregion

                                #endregion
                                #region MagicDefender
                                
case 11200:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse spellUse = new SpellUse(true);
                                            
spellUse.Attacker attacker.UID;
                                            
spellUse.SpellID spell.ID;
                                            
spellUse.SpellLevel spell.Level;
                                            
spellUse.X;
                                            
spellUse.Y;
                                            if (
attacker.Owner.Team != null)
                                            {
                                                foreach (var 
mate in attacker.Owner.Team.Teammates)
                                                {
                                                    if (
Kernel.GetDistance(attacker.Xattacker.Ymate.Player.Xmate.Player.Y) <= 4)
                                                    {
                                                        
spellUse.AddTarget(mate.Player0attack);
                                                        if (
attacker.UID == mate.Player.UID)
                                                            
mate.Player.MagicDefenderOwner true;
                                                        
mate.Player.HasMagicDefender true;
                                                        
mate.Player.MagicDefenderSecs = (byte)spell.Duration;
                                                        
attacker.RemoveFlag3(Mr_Panda.Network.GamePackets.Update.Flags3.MagicDefender);
                                                        
mate.Player.AddFlag3(Mr_Panda.Network.GamePackets.Update.Flags3.MagicDefender);
                                                        
mate.Player.Update(mate.Player.StatusFlagmate.Player.StatusFlag2mate.Player.StatusFlag3Update.MagicDefenderIcone0x80mate.Player.MagicDefenderSecs0false);
                                                        
mate.Player.MagicDefenderStamp Time32.Now;
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
spellUse.AddTarget(attacker0null);
                                                
attacker.Owner.Player.HasMagicDefender true;
                                                
attacker.Owner.Player.MagicDefenderOwner true;
                                                
attacker.Owner.Player.MagicDefenderSecs = (byte)spell.Duration;
                                                
attacker.RemoveFlag3(Mr_Panda.Network.GamePackets.Update.Flags3.MagicDefender);
                                                
attacker.AddFlag3(Mr_Panda.Network.GamePackets.Update.Flags3.MagicDefender);
                                                
attacker.Owner.Player.Update(attacker.Owner.Player.StatusFlagattacker.Owner.Player.StatusFlag2attacker.Owner.Player.StatusFlag3Update.MagicDefenderIcone0x80attacker.Owner.Player.MagicDefenderSecs0false);
                                                
attacker.Owner.Player.MagicDefenderStamp Time32.Now;
                                            }
                                            
attacker.Owner.SendScreen(spellUsetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region DefensiveStance
                                
case 11160:
                                    {
                                        if (
Time32.Now >= attacker.DefensiveStanceStamp.AddSeconds(10))
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);
                                                
SpellUse spellUse = new SpellUse(true);
                                                
spellUse.Attacker attacker.UID;
                                                
spellUse.SpellID spell.ID;
                                                
spellUse.SpellLevel spell.Level;
                                                
spellUse.X;
                                                
spellUse.Y;
                                                
attacker.Owner.SendScreen(spellUsetrue);
                                                if (
attacker.IsDefensiveStance)
                                                {
                                                    
attacker.RemoveFlag2(Mr_Panda.Network.GamePackets.Update.Flags2.Fatigue);
                                                    
attacker.IsDefensiveStance false;
                                                }
                                                else
                                                {
                                                    
attacker.FatigueSecs spell.Duration;
                                                    
attacker.FatigueStamp Time32.Now;
                                                    
attacker.AddFlag2(Mr_Panda.Network.GamePackets.Update.Flags2.Fatigue);
                                                    
attacker.Update(attacker.Owner.Player.StatusFlagattacker.Owner.Player.StatusFlag2attacker.Owner.Player.StatusFlag3Update.DefensiveStance0x7E, (uint)spell.Duration, (uint)(spell.Level 1), false);
                                                    
attacker.IsDefensiveStance true;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            
attacker.Owner.Send(new Message("You need to wait 10 seconds in order to cast the spell again!"Color.RedMessage.TopLeft));
                                        }
                                        break;
                                    }
                                
#endregion
                                #region ShieldBlock
                                
case 10470// Shield Block
                                    
{

                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);
                                                
SpellUse spellUse = new SpellUse(true);
                                                
spellUse.Attacker attacker.UID;
                                                
spellUse.SpellID spell.ID;
                                                
spellUse.SpellLevel spell.Level;
                                                
spellUse.X;
                                                
spellUse.Y;
                                                
attacker.Owner.SendScreen(spellUsetrue);
                                                if (
attacker.IsShieldBlock)
                                                {
                                                    
Network.GamePackets.Update aupgrade = new Network.GamePackets.Update(true);
                                                    
aupgrade.UID attacker.UID;
                                                    
aupgrade.Append(49
                                                   
113
                                                   
, (uint)000);
                                                    
attacker.Owner.Send(aupgrade);
                                                    
attacker.IsShieldBlock false;
                                                }
                                                else
                                                {
                                                    
attacker.ShieldBlockStamp Time32.Now;
                                                    
attacker.ShieldBlockPercent = (ushort)spell.Power;
                                                    
Network.GamePackets.Update aupgrade = new Network.GamePackets.Update(true);
                                                    
aupgrade.UID attacker.UID;
                                                    
aupgrade.Append(49
                                                   
113
                                                   
, (uint)spell.Durationspell.Powerspell.Level);
                                                    
attacker.Owner.Send(aupgrade);
                                                    
attacker.IsShieldBlock true;
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Assassin
                                #region Blistering Wave
                                
case 11650:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (!
attacker.ContainsFlag3(Update.Flags3.Assassin))
                                                return;
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
Sector sector = new Sector(attacker.Xattacker.YXY);
                                            
sector.Arrange(spell.Sectorspell.Distance);
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;

                                                    if (
sector.Inside(attacked.Xattacked.Y))
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                            {
                                                                
damage = (uint)(damage 0.608);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                            {
                                                                
damage = (uint)(damage 0.708);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                            {
                                                                
damage = (uint)(damage 0.775);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                            {
                                                                
damage = (uint)(damage 0.820);
                                                            }
                                                            
suse.Effect1 attack.Effect1;

                                                            
ReceiveAttack(attackerattackedattackref damagespell);
                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
attackedsob _obj as SobNpcSpawn;

                                                    if (
sector.Inside(attackedsob.Xattackedsob.Y))
                                                    {
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);


                                                            
suse.Effect1 attack.Effect1;
                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region PathOfJoseph
                                
case 11620:
                                    {
                                        var 
weps attacker.Owner.Weapons;
                                        if ((
weps.Item1 != null && weps.Item1.ID 1000 != 613) || (weps.Item2 != null && weps.Item2.ID 1000 != 613))
                                        {
                                            
attacker.Owner.Send(new Message("You need to wear only knifes!"Color.RedMessage.Talk));
                                            return;
                                        }
                                        
SpellUse spellUse = new SpellUse(true);
                                        
spellUse.Attacker attacker.UID;
                                        
spellUse.SpellID spell.ID;
                                        
spellUse.SpellLevel spell.Level;
                                        
spellUse.X;
                                        
spellUse.Y;
                                        
attacker.Owner.SendScreen(spellUsetrue);
                                        if (
attacker.ContainsFlag3(Update.Flags3.Assassin))
                                        {
                                            
attacker.RemoveFlag3(Update.Flags3.Assassin);
                                            if (
attacker.ContainsFlag3(Update.Flags3.BladeFlurry))
                                                
attacker.RemoveFlag3(Update.Flags3.BladeFlurry);
                                            if (
attacker.ContainsFlag3(Update.Flags3.KineticSpark))
                                                
attacker.RemoveFlag3(Update.Flags3.KineticSpark);
                                        }
                                        else
                                            
attacker.AddFlag3(Update.Flags3.Assassin);
                                        break;
                                    }
                                
#endregion
                                #region Blade Furry
                                
case 11610:
                                    {
                                        if (!
attacker.ContainsFlag3(Update.Flags3.Assassin))
                                            return;
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.X;
                                        
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                        
suse.Y;
                                        if (
attacker.ContainsFlag(Update.Flags.XPList))
                                        {
                                            
attacker.AddFlag3(Update.Flags3.BladeFlurry);
                                            
attacker.BladeFlurryStamp Time32.Now;
                                            
attacker.RemoveFlag(Update.Flags.XPList);
                                        }
                                        else
                                        {
                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Range)
                                            {
                                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (
_obj == null) continue;
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedattackref damagespell);
                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                        {
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                
suse.Effect1 attack.Effect1;

                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.Owner.SendScreen(susetrue);
                                        break;
                                    }
                                
#endregion
                                #region Mortal Wound
                                
case 11660:
                                    {
                                        if (
attacker.Stamina >= 60)
                                            
attacker.Stamina -= 60;
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (!
attacker.ContainsFlag3(Update.Flags3.Assassin))
                                                return;
                                            if (
Time32.Now attacker.MortalWoundStamp.AddMilliseconds(300))
                                            {
                                                
attacker.MortalWoundStamp Time32.Now;
                                                
PrepareSpell(spellattacker.Owner);
                                                
attacker.AttackPacket null;
                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
suse.SpellLevel spell.Level;
                                                
suse.X;
                                                
suse.Y;
                                                if (
attackedsob == null)
                                                {
                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {
                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                        {
                                                            
damage = (uint)(damage 0.655);
                                                        }
                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                        {
                                                            
damage = (uint)(damage 0.6);
                                                        }
                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                        {
                                                            
damage = (uint)(damage 0.6);
                                                        }
                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                        {
                                                            
damage = (uint)(damage 0.4);
                                                        }
                                                        
suse.Effect1 attack.Effect1;
                                                        
ReceiveAttack(attackerattackedattackref damagespell);
                                                        
suse.AddTarget(attackeddamageattack);
                                                        
attacker.Owner.SendScreen(susetrue);
                                                    }
                                                }
                                                else
                                                {
                                                    if (
CanAttack(attackerattackedsobspell))
                                                    {
                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
damage = (uint)(damage 1.5);
                                                        
suse.Effect1 attack.Effect1;

                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                        
suse.AddTarget(attackedsobdamageattack);
                                                        
attacker.Owner.SendScreen(susetrue);
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion

                                #region Spirit Focus
                                
case 9000:
                                case 
11670:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (
spell.ID == 11670)
                                                if (!
attacker.ContainsFlag3(Update.Flags3.Assassin))
                                                    return;

                                            
PrepareSpell(spellattacker.Owner);

                                            
attack = new Attack(true);
                                            
attack.Attacker attacker.UID;
                                            
attack.Attacked attacker.UID;
                                            
attack.AttackType Attack.Magic;
                                            
attack.attacker.X;
                                            
attack.attacker.Y;
                                            
attack.Damage spell.ID;
                                            
attack.KOCount spell.Level;
                                            
attacker.Owner.SendScreen(attacktrue);

                                            
attacker.IntensifyPercent spell.PowerPercent;
                                            
attacker.IntensifyStamp Time32.Now;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Kinetic Spark
                                
case 11590:
                                    {
                                        if (!
attacker.ContainsFlag3(Update.Flags3.Assassin))
                                            return;

                                        
SpellUse spellUse = new SpellUse(true);
                                        
spellUse.Attacker attacker.UID;
                                        
spellUse.SpellID spell.ID;
                                        
spellUse.SpellLevel spell.Level;
                                        
spellUse.X;
                                        
spellUse.Y;
                                        
attacker.Owner.SendScreen(spellUsetrue);

                                        if (
attacker.ContainsFlag3(Update.Flags3.KineticSpark))
                                            
attacker.RemoveFlag3(Update.Flags3.KineticSpark);
                                        else
                                            
attacker.AddFlag3(Update.Flags3.KineticSpark);
                                        break;
                                    }
                                
#endregion
                                #region Dagger Storm
                                
case 11600:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (!
attacker.ContainsFlag3((ulong)Update.Flags3.Assassin)) return;
                                            var 
map attacker.Owner.Map;
                                            if (!
map.Floor[XYMapObjectType.Itemnull]) return;
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.AddTarget(attacker0null);
                                            
attacker.Owner.SendScreen(susetrue);
                                            
FloorItem flooritem = new FloorItem(true);
                                            if (
attacker.Owner.Spells[spellID].LevelHu2 == 1)
                                            {

                                                
flooritem.ItemID FloorItem.FuryofEgg;
                                                
flooritem.X;
                                                
flooritem.MapID map.ID;
                                                
flooritem.Y;
                                                
flooritem.Type FloorItem.Effect;
                                                
flooritem.mColor 10;
                                                
flooritem.OwnerUID attacker.UID;
                                                
flooritem.OnFloor Time32.Now;
                                                
flooritem.Owner attacker.Owner;
                                                
flooritem.Name "FuryofEgg";
                                                
map.AddFloorItem(flooritem);
                                                
attacker.Owner.SendScreenSpawn(flooritemtrue);
                                            }
                                            else if (
attacker.Owner.Spells[spellID].LevelHu2 == 2)
                                            {
                                                
flooritem.ItemID FloorItem.ShacklingIce;
                                                
flooritem.X;
                                                
flooritem.MapID map.ID;
                                                
flooritem.Y;
                                                
flooritem.Type FloorItem.Effect;
                                                
flooritem.mColor 10;
                                                
flooritem.OwnerUID attacker.UID;
                                                
flooritem.OnFloor Time32.Now;
                                                
flooritem.Owner attacker.Owner;
                                                
flooritem.Name "ShacklingIce";
                                                
map.AddFloorItem(flooritem);
                                                
attacker.Owner.SendScreenSpawn(flooritemtrue);

                                            }
                                            else
                                            {
                                                
flooritem.ItemID FloorItem.DaggerStorm;
                                                
flooritem.X;
                                                
flooritem.MapID map.ID;
                                                
flooritem.Y;
                                                
flooritem.Type FloorItem.Effect;
                                                
flooritem.mColor 10;
                                                
flooritem.OwnerUID attacker.UID;
                                                
flooritem.OnFloor Time32.Now;
                                                
flooritem.Owner attacker.Owner;
                                                
flooritem.Name "DaggerStorm";
                                                
map.AddFloorItem(flooritem);
                                                
attacker.Owner.SendScreenSpawn(flooritemtrue);

                                            }

                                        }
                                        break;
                                    }
                                
#endregion

                                #endregion
                                #region ChainBolt
                                
case 10309:
                                    {
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.attacker.X;
                                        
suse.attacker.Y;
                                        if (
attacked != null)
                                        {
                                            if (
attacker.ContainsFlag2(Update.Flags2.ChainBoltActive))
                                            {
                                                
PrepareSpell(spellattacker.Owner);
                                                
suse.X;
                                                
suse.Y;
                                                
int maxR spell.Distance;
                                                if (
attacked != null)
                                                {
                                                    if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= maxR)
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Magic(attackerattackedspellref attack);
                                                            
ReceiveAttack(attackerattackedattackref damagespell);
                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                }
                                                var Array = 
attacker.Owner.Screen.Objects;
                                                var 
closestTarget findClosestTarget(attackedattacked.Xattacked.Y, Array);
                                                
ushort x closestTarget.XclosestTarget.Y;
                                                
int targets Math.Max((int)spell.Level1);

                                                foreach (
Interfaces.IMapObject _obj in Array)
                                                {
                                                    if (
targets == 0) continue;
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;

                                                        if (
Kernel.GetDistance(xyattacked.Xattacked.Y) <= maxR)
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
maxR 6;

                                                                var 
damage2 Game.Attacking.Calculate.Magic(attackerattackedspellref attack);
                                                                
damage2 = (uint)(damage2 2);
                                                                
ReceiveAttack(attackerattackedattackref damage2spell);

                                                                
suse.AddTarget(attackeddamage2attack);
                                                                
attacked.X;
                                                                
attacked.Y;
                                                                
targets--;
                                                            }
                                                        }
                                                    }
                                                }
                                                if (
suse.Targets.Count == 0) return;
                                                
attacker.Owner.SendScreen(susetrue);
                                            }
                                            else
                                            {
                                                if (
CanUseSpell(spellattacker.Owner))
                                                {
                                                    
PrepareSpell(spellattacker.Owner);
                                                    
attacker.ChainboltStamp Time32.Now;
                                                    
attacker.ChainboltTime spell.Duration;
                                                    
attacker.AddFlag2(Update.Flags2.ChainBoltActive);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region ChargingVortex
                                
case 1260:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
spell.UseStamina 20;
                                            
PrepareSpell(spellattacker.Owner);
                                            
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
                                        
Xattacker.YY, (byte)spell.RangeInLineAlgorithm.Algorithm.DDA);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
ila.InLine(attacked.Xattacked.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            continue;

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attackclient_Spell.LevelHu2);
                                                        
suse.Effect1 attack.Effect1;
                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
suse.AddTarget(attackeddamageattack);
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
attackedsob _obj as SobNpcSpawn;

                                                    if (
ila.InLine(attackedsob.Xattackedsob.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedsobspell))
                                                            continue;

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                        
suse.AddTarget(attackedsobdamageattack);
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#region RadiantPalm
                                
case 10381:
                                    {
                                        if (
Time32.Now >= attacker.SpellStamp.AddMilliseconds(695))
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
attacker.SpellStamp Time32.Now;
                                                
ushort XxYx;
                                                if (
attacked != null)
                                                {
                                                    
Xx attacked.X;
                                                    
Yx attacked.Y;
                                                }
                                                else
                                                {
                                                    
Xx attackedsob.X;
                                                    
Yx attackedsob.Y;
                                                }
                                                if (
Kernel.GetDistance(attacker.Xattacker.YXxYx) <= 7)
                                                {
                                                    if (
attackedsob == null)
                                                        if (
attacked.ContainsFlag(Update.Flags.Fly))
                                                            return;
                                                    if (
attacker.ContainsFlag(Update.Flags.Fly))
                                                        return;
                                                    
PrepareSpell(spellattacker.Owner);
                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;

                                                    
bool send false;
                                                    if (
attackedsob == null)
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                            {
                                                                
damage = (uint)(damage 0.938);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                            {
                                                                
damage = (uint)(damage 0.925);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                            {
                                                                
damage = (uint)(damage 0.900);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                            {
                                                                
damage = (uint)(damage 0.850);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
                                                            {
                                                                
damage = (uint)(damage 0.844);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
                                                            {
                                                                
damage = (uint)(damage 0.799);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                            {
                                                                
damage = (uint)(damage 0.788);
                                                            }
                                                            
suse.Effect1 attack.Effect1;
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                            
send true;
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                            
damage = (uint)(damage 180 100);
                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                            
suse.Effect1 attack.Effect1;
                                                            
suse.AddTarget(attackedsobdamageattack);
                                                            
send true;
                                                        }
                                                    }
                                                    if (
send)
                                                        
attacker.Owner.SendScreen(susetrue);
                                                }
                                            }
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                
case 10315:
                                    {
                                        if (
spell.ID == 10315)
                                        {
                                            if (
attacker.Owner.Weapons.Item1 == null) return;
                                            if (
attacker.Owner.Weapons.Item1.IsTwoHander()) return;
                                        }
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
UInt16 oxoy;
                                            
ox attacker.X;
                                            
oy attacker.Y;
                                            if (
spellID == 10315)
                                            {
                                                
Attack npacket = new Attack(true);
                                                
npacket.Attacker attacker.UID;
                                                
npacket.AttackType 53;
                                                
npacket.X;
                                                
npacket.Y;
                                                
Writer.WriteUInt16(spell.ID28npacket.ToArray());
                                                
Writer.WriteByte(spell.Level30npacket.ToArray());
                                                
attacker.Owner.SendScreen(npackettrue);
                                                
attacker.X;
                                                
attacker.Y;
                                                
attacker.SendSpawn(attacker.Owner);
                                                
attacker.Owner.Screen.Reload(npacket);
                                            }
                                            List<
IMapObjectobjects = new List<IMapObject>();
                                            if (
attacker.Owner.Screen.Objects.Count() > 0)
                                                
objects GetObjects(oxoyattacker.Owner);
                                            if (
objects != null)
                                            {
                                                if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Range)
                                                {
                                                    if (
spellID == 10315)
                                                    {
                                                        foreach (
IMapObject objs in objects.ToArray())
                                                        {
                                                            if (
objs == null) continue;
                                                            if (
objs.MapObjType == MapObjectType.Monster || objs.MapObjType == MapObjectType.Entity)
                                                            {
                                                                
attacked objs as Entity;
                                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                                {
                                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                                        
damage = (uint)(damage 0.8);
                                                                        
suse.Effect1 attack.Effect1;
                                                                        if (
spell.Power 0)
                                                                        {
                                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                                            
damage Game.Attacking.Calculate.Magic(attackerattackedspellref attack);
                                                                            
suse.Effect1 attack.Effect1;
                                                                        }
                                                                        if (
spell.ID == 8030)
                                                                        {
                                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                                            
damage Game.Attacking.Calculate.Ranged(attackerattackedref attack);
                                                                        }
                                                                        
suse.Effect1 attack.Effect1;
                                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                                        
suse.AddTarget(attackeddamageattack);
                                                                    }
                                                                }
                                                            }
                                                            else if (
objs.MapObjType == MapObjectType.SobNpc)
                                                            {
                                                                
attackedsob objs as SobNpcSpawn;
                                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                                {
                                                                    if (
CanAttack(attackerattackedsobspell))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                        if (
spell.Power 0)
                                                                        {
                                                                            
damage Game.Attacking.Calculate.Magic(attackerattackedsobspellref attack);
                                                                        }
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        if (
spell.ID == 8030)
                                                                            
damage Game.Attacking.Calculate.Ranged(attackerattackedsobref attack);
                                                                        
suse.Effect1 attack.Effect1;
                                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                                        
suse.AddTarget(attackedsobdamageattack);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                        {
                                                            if (
_obj == null) continue;
                                                            if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                            {
                                                                
attacked _obj as Entity;
                                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                                {
                                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                                        
suse.Effect1 attack.Effect1;
                                                                        if (
spell.Power 0)
                                                                        {
                                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                                            
damage Game.Attacking.Calculate.Magic(attackerattackedspellref attack);
                                                                            
suse.Effect1 attack.Effect1;
                                                                        }
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        if (
spell.ID == 8030)
                                                                            
damage Game.Attacking.Calculate.Ranged(attackerattackedref attack);
                                                                        if (
spell.ID == 1115)
                                                                            
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                                        
ReceiveAttack(attackerattackedattackref damagespell);
                                                                        
suse.AddTarget(attackeddamageattack);
                                                                    }
                                                                }
                                                            }
                                                            else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                            {
                                                                
attackedsob _obj as SobNpcSpawn;
                                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                                {
                                                                    if (
CanAttack(attackerattackedsobspell))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                        if (
spell.Power 0)
                                                                            
damage Game.Attacking.Calculate.Magic(attackerattackedsobspellref attack);
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        if (
spell.ID == 8030)
                                                                            
damage Game.Attacking.Calculate.Ranged(attackerattackedsobref attack);
                                                                        
suse.Effect1 attack.Effect1;
                                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                                        
suse.AddTarget(attackedsobdamageattack);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    
attacker.AttackPacket null;
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                            
Calculations.IsBreaking(attacker.Owneroxoy);
                                        }
                                        break;
                                    }
                                
#region ChargingVortex
                                
case 11190:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (
attacker.Owner.Map.Floor[XYMapObjectType.InvalidCastnull])
                                                break;
                                            
spell.UseStamina 20;
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
UInt16 oxoy;
                                            
ox attacker.X;
                                            
oy attacker.Y;
                                            
attack.X;
                                            
attack.Y;
                                            
attack.Attacker attacker.UID;
                                            
attack.AttackType 53;
                                            
attack.X;
                                            
attack.Y;
                                            
attacker.Owner.SendScreen(attacktrue);
                                            
attacker.X;
                                            
attacker.Y;
                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Range)
                                            {

                                                var Array = 
attacker.Owner.Screen.Objects;

                                                foreach (
Interfaces.IMapObject _obj in Array)
                                                {
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
Kernel.GetDistance(XYattacked.Xattacked.Y) > spell.Range)
                                                            continue;
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);

                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                        {
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                            
Calculations.IsBreaking(attacker.Owneroxoy);
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.Owner.Screen.Reload(suse);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region Heaven Blade
                                
case 10310:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            if (
attacked != null)
                                            {
                                                if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                                {
                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;

                                                    if (
CanAttack(attackerattackedspellfalse))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        var 
damage Game.Attacking.Calculate.Magic(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                        
damage = (uint)(damage 1.4);
                                                        if (
Kernel.Rate(spell.Percent))
                                                        {
                                                            
ReceiveAttack(attackerattackedattackref damagespell);
                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                        else
                                                        {
                                                            
damage 0;
                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                        
attacker.Owner.SendScreen(susetrue);
                                                    }
                                                }
                                                else
                                                {
                                                    
attacker.AttackPacket null;
                                                }
                                            }
                                            else
                                            {
                                                if (
attackedsob != null)
                                                {
                                                    if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Distance)
                                                    {
                                                        
SpellUse suse = new SpellUse(true);
                                                        
suse.Attacker attacker.UID;
                                                        
suse.SpellID spell.ID;
                                                        
suse.SpellLevel spell.Level;
                                                        
suse.X;
                                                        
suse.Y;

                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            
PrepareSpell(spellattacker.Owner);
                                                            var 
damage Game.Attacking.Calculate.Magic(attackerattackedsobspellref attack);
                                                            if (
Kernel.Rate(spell.Percent))
                                                            {
                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                            else
                                                            {
                                                                
damage 0;
                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                            
attacker.Owner.SendScreen(susetrue);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region New Trojan
                                #region SuperCyclone
                                
case 11970:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            if (!
attacked.OnKOSpell())
                                                
attacked.KOCount 0;
                                            
attacked.KOSpell spell.ID;
                                            
suse.AddTarget(attacked0attack);
                                            
attacked.SuperCycloneStamp Time32.Now;
                                            
attacked.SuperCycloneTime 40;
                                            
attacked.AddFlag3(Update.Flags3.SuperCyclone);
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region FatalCross
                                
case 11980:
                                    {
                                        if (
Time32.Now >= attacker.SpellStamp.AddMilliseconds(50))
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);
                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
suse.SpellLevel spell.Level;
                                                
ushort _X attacker.X_Y attacker.Y;
                                                
ushort _tX X_tY Y;
                                                
byte dist = (byte)spell.Distance;
                                                var Array = 
attacker.Owner.Screen.Objects;
                                                
InLineAlgorithm algo = new InLineAlgorithm(attacker.XXattacker.YYdist,
                                                                                   
InLineAlgorithm.Algorithm.DDA);
                                                
// X = attacker.X;
                                                //  Y = attacker.Y;
                                                
int i algo.lcoords.Count;
                                                
/* for (i = 0; i < algo.lcoords.Count; i++)
                                                 {
                                                     if (attacker.Owner.Map.Floor[algo.lcoords[i].X, algo.lcoords[i].Y, MapObjectType.Player]
                                                         && !attacker.ThroughGate(algo.lcoords[i].X, algo.lcoords[i].Y))
                                                     {
                                                         X = (ushort)algo.lcoords[i].X;
                                                         Y = (ushort)algo.lcoords[i].Y;
                                                     }
                                                     else
                                                     {
                                                         break;
                                                     }
                                                 }*/
                                                //double disth = 1.5;
                                                //   if (attacker.MapID == DeathMatch.MAPID) disth = 1;
                                                
suse.X;
                                                
suse.Y;
                                                foreach (
Interfaces.IMapObject _obj in Array)
                                                {
                                                    
bool hit false;
                                                    for (
int j 0ij++)
                                                        if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= 4)
                                                            
hit true;
                                                    if (
hit)
                                                    {
                                                        if (
_obj.MapObjType == MapObjectType.Monster)
                                                        {
                                                            
attacked _obj as Entity;
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                var 
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                                
damage = (damage 36) / 100;

                                                                
ReceiveAttack(attackerattackedattackref damagespell);

                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                        else if (
_obj.MapObjType == MapObjectType.Entity)
                                                        {
                                                            
attacked _obj as Entity;
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                {
                                                                    
damage = (uint)(damage 0.790);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                {
                                                                    
damage = (uint)(damage 0.750);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                {
                                                                    
damage = (uint)(damage 0.730);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                                {
                                                                    
damage = (uint)(damage 0.690);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
                                                                {
                                                                    
damage = (uint)(damage 0.550);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
                                                                {
                                                                    
damage = (uint)(damage 0.450);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                                {
                                                                    
damage = (uint)(damage 0.450);
                                                                }
                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedattackref damagespell);
                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                        else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                        {
                                                            
attackedsob _obj as SobNpcSpawn;
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                var 
damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                                
attacker.Owner.SendScreen(susetrue);
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region BreathFocus
                                
case 11960:
                                    {
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.attacker.X;
                                        
suse.attacker.Y;
                                        
suse.Targets.Add(attacker.UID1);
                                        
attacker.Owner.SendScreen(susetrue);
                                        
attacker.Stamina += (byte)spell.Power;
                                        
attacker.Owner.Send(new Message("Your Stamina has increased by " spell.PowerMessage.TopLeft));
                                        break;
                                    }
                                
#endregion
                                #region MortalStrike
                                
case 11990:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
Sector sector = new Sector(attacker.Xattacker.YXY);
                                            
sector.Arrange(spell.Sectorspell.Range);
                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Range 1)
                                            {
                                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (
_obj == null)
                                                        continue;
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;

                                                        if (
sector.Inside(attacked.Xattacked.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                var 
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                                
damage = (uint)(damage 1.0);
                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedattackref damagespell);

                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;

                                                        if (
sector.Inside(attackedsob.Xattackedsob.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region Windwalker
                                #region Chaser
                                #region ShadowofChaser(Active)
                                
case 13090:
                                    {
                                        if (
attacker.ContainsFlag4(Update.Flags4.ShadowofChaser))
                                        {
                                            
attacker.RemoveFlag4(Update.Flags4.ShadowofChaser);
                                            
attacker.AttackPacket null;
                                            break;
                                        }
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.AddTarget(attacker0null);
                                            
attack = new Attack(true);
                                            
attack.Attacker attack.Attacked attacker.UID;
                                            
attack.attacker.Xattack.attacker.Y;
                                            
attack.AttackType 24;
                                            
attack.SpellID spell.ID;
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.AddFlag4(Update.Flags4.ShadowofChaser);
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region ThunderCloud[Chaser]
                                
case 12840:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
attacker.GreenEffect 10;
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            var 
cl = new WindWalker.ThunderCloud(attacker.Ownerattack.Xattack.Y);
                                            
suse.AddTarget(cl.UID0null);
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region ThunderBolt[Chaser]
                                
case 12970:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
//attacker.GreenEffect = 10;
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.AddTarget(attacker.UID0null);
                                            
attacker.Owner.SendScreen(susetrue);
                                            foreach (var 
Cloud in attacker.Owner.Map.Clouds.Values.ToList())
                                            {
                                                
Cloud.ThunderBolt true;
                                                
attacker.ThunderBolt true;
                                                
//Cloud.DisposeCloud2(attacker.Owner);
                                                
if (Kernel.GetDistance(Cloud.XCloud.Yattacker.Owner.Player.Xattacker.Owner.Player.Y) > 16) continue;
                                                
Cloud.SendSpawn2(attacker.Ownerfalse);
                                                
//ThunderCloud cl = new ThunderCloud(attacker.Owner, Cloud.X, Cloud.Y);
                                            
}

                                        }
                                        break;
                                    }
                                
#endregion
                                #region TripleBlasts(Passive)
                                
case 12850:
                                    if (
attacker.Stamina >= 10)
                                        
attacker.Stamina -= 10;
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attackedsob == null attacked.UID attackedsob.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            if (
attackedsob == null)
                                            {
                                                if (
CanAttack(attackerattackedspellfalse))
                                                {
                                                    if (
attacker.ContainsFlag4(Update.Flags4.ShadowofChaser) && attacker.IsChaser2())
                                                    {
                                                        var 
spell2 Database.SpellTable.GetSpell(13090attacker.Owner);
                                                        if (
spell2 != null)
                                                        {
                                                            
spell2.CanKill true;
                                                            if (
Kernel.Rate(spell2.Percent))
                                                            {
                                                                
ShadowofChaser(attackerattackedattack1);
                                                                break;
                                                            }
                                                        }
                                                    }
                                                    
attack.Effect1 Attack.AttackEffects1.None;
                                                    
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                    {
                                                        
damage = (uint)(damage 0.450);
                                                    }
                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                    {
                                                        
damage = (uint)(damage 0.440);
                                                    }
                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                    {
                                                        
damage = (uint)(damage 0.430);
                                                    }
                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                    {
                                                        
damage = (uint)(damage 0.420);
                                                    }
                                                    
suse.Effect1 attack.Effect1;
                                                    
ReceiveAttack(attackerattackedattackref damagespell);
                                                    
suse.AddTarget(attackeddamageattack);
                                                    
attacker.Owner.SendScreen(susetrue);
                                                }
                                            }
                                            else
                                            {
                                                if (
CanAttack(attackerattackedsobspell))
                                                {
                                                    
attack.Effect1 Attack.AttackEffects1.None;
                                                    
uint damage Game.Attacking.Calculate.Ranged(attackerattackedsobref attack);
                                                    
suse.Effect1 attack.Effect1;
                                                    
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                    
suse.AddTarget(attackedsobdamageattack);
                                                    
attacker.Owner.SendScreen(susetrue);
                                                }
                                            }

                                        }
                                        break;
                                    }
                                
#endregion
                                #region SwirlingStorm(Passive)
                                
case 12890:
                                    if (
attacker.Stamina >= 15)
                                        
attacker.Stamina -= 15;
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
Sector sector = new Sector(attacker.Xattacker.YXY);
                                            
sector.Arrange(spell.Sectorspell.Distance);
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                
byte dist = (byte)spell.Distance;
                                                
InLineAlgorithm algo = new InLineAlgorithm(attacker.XXattacker.YYdistInLineAlgorithm.Algorithm.DDA);
                                                
int i algo.lcoords.Count;
                                                
double disth 3.0;
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
bool hit false;
                                                    for (
int j 0ij++)
                                                        if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                            
hit true;
                                                    if (
hit)
                                                    {
                                                        
attacked _obj as Entity;

                                                        if (
sector.Inside(attacked.Xattacked.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                {
                                                                    
damage = (uint)(damage 0.570);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                {
                                                                    
damage = (uint)(damage 0.560);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                {
                                                                    
damage = (uint)(damage 0.550);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                                {
                                                                    
damage = (uint)(damage 0.5);
                                                                }
                                                                
ReceiveAttack(attackerattackedattackref damagespell);
                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.Monster)
                                                {
                                                    
bool hit false;
                                                    for (
int j 0ij++)
                                                        if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                            
hit true;
                                                    if (
hit)
                                                    {
                                                        
attacked _obj as Entity;

                                                        if (
sector.Inside(attacked.Xattacked.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {

                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                                
damage = (uint)(damage 0.9);
                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedattackref damagespell);
                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
bool hit false;
                                                    for (
int j 0ij++)
                                                        if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                            
hit true;
                                                    if (
hit)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
attackedsob == null) continue;
                                                        if (
sector.Inside(attackedsob.Xattackedsob.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;

                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                
damage = (uint)(damage 0.3);
                                                                
attack.Damage 0;
                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        else
                                        {
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Omnipotence(XP)
                                
case 12860:
                                    {
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.X;
                                        
suse.Y;
                                        if (
attacker.ContainsFlag(Update.Flags.XPList))
                                        {
                                            
attacker.AddFlag4(Update.Flags4.Omnipotence);
                                            
attacker.OmnipotenceStamp Time32.Now;
                                            
attacker.RemoveFlag(Update.Flags.XPList);
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        else
                                        {
                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Range)
                                            {
                                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (
_obj == null) continue;
                                                    if (
_obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
attacked == null) break;
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack) / 10;
                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedattackref damagespell);
                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
attackedsob == null) continue;
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattackedsob.Xattackedsob.Y) <= spell.Range)
                                                        {
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                                
damage = (uint)(damage 0.6);
                                                                
suse.Effect1 attack.Effect1;

                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.Monster)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                                
damage = (uint)(damage 0.5);
                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedattackref damagespell);
                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.Owner.SendScreen(susetrue);
                                        
attacker.AttackPacket null;
                                        break;
                                    }
                                
#endregion
                                #region FrostGaze(I-II-III)
                                
case 12830:
                                case 
13070:
                                case 
13080:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
attacker.Owner.SendScreen(susetrue);
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
attacked == null) break;
                                                    if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Range)
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
int Rate 100;
                                                            
int diff attacked.BattlePower attacker.BattlePower;
                                                            if (
diff 0diff 0;
                                                            
Rate -= (byte)(diff 5);
                                                            if (
Rate 0Rate 0;
                                                            if (
Kernel.Rate(Rate))
                                                            {
                                                                if (
attacked.Stamina >= (byte)spell.Power)
                                                                    
attacked.Stamina -= (byte)spell.Power;
                                                                else 
attacked.Stamina 0;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region Stomper
                                #region ChillingSnow(Active)
                                
case 12960:
                                    {
                                        if (
attacker.ContainsFlag4(Update.Flags4.ChillingSnow))
                                        {
                                            
attacker.RemoveFlag4(Update.Flags4.ChillingSnow);
                                            
attacker.AttackPacket null;
                                            break;
                                        }
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
attacker.RemoveFlag4(Update.Flags4.HealingSnow);
                                            
attacker.RemoveFlag4(Update.Flags4.FreezingPelter);
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
suse.AddTarget(attacker0attack);
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.AddFlag4(Update.Flags4.ChillingSnow);
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region HealingSnow(Active)
                                
case 12950:
                                    {
                                        if (
attacker.ContainsFlag4(Update.Flags4.HealingSnow))
                                        {
                                            
attacker.RemoveFlag4(Update.Flags4.HealingSnow);
                                            
attacker.AttackPacket null;
                                            break;
                                        }
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
attacker.RemoveFlag4(Update.Flags4.ChillingSnow);
                                            
attacker.RemoveFlag4(Update.Flags4.FreezingPelter);
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
suse.AddTarget(attacker0attack);
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.AddFlag4(Update.Flags4.HealingSnow);
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region FreezingPelter(Active)
                                
case 13020:
                                    {
                                        if (
attacker.ContainsFlag4(Update.Flags4.FreezingPelter))
                                        {
                                            
attacker.RemoveFlag4(Update.Flags4.FreezingPelter);
                                            
attacker.Owner.LoadItemStats();
                                            
attacker.AttackPacket null;
                                            break;
                                        }
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
attacker.RemoveFlag4(Update.Flags4.ChillingSnow);
                                            
attacker.RemoveFlag4(Update.Flags4.HealingSnow);
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
suse.AddTarget(attacker0attack);
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.AddFlag4(Update.Flags4.FreezingPelter);
                                            
attacker.Owner.LoadItemStats();
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region RevengeTail(Active)
                                
case 13030:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
suse.AddTarget(attacker0attack);
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.AddFlag4(Update.Flags4.RevengeTaill);
                                            
attacker.RevengeTaillStamp Time32.Now;
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region BurntFrost[Stomper]
                                
case 12940:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner); if (CanUseSpell(spellattacker.Owner))
                                                
attacker.GreenEffect 10;
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
Sector sector = new Sector(attacker.Xattacker.YXY);
                                            
sector.Arrange(180spell.Distance);
                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Distance 5)
                                            {
                                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (
_obj == null) continue;
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
sector.Inside(attacked.Xattacked.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                {
                                                                    
damage = (uint)(damage 0.580);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                {
                                                                    
damage = (uint)(damage 0.570);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                {
                                                                    
damage = (uint)(damage 0.560);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                                {
                                                                    
damage = (uint)(damage 0.550);
                                                                }
                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedattackref damagespell);
                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
attackedsob == null) continue;
                                                        
//if (attackedsob == null) Console.WriteLine(Environment.StackTrace);
                                                        
if (sector.Inside(attackedsob.Xattackedsob.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                
suse.Effect1 attack.Effect1;
                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region RageofWar(Passive)
                                
case 12930:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
Game.Attacking.InLineAlgorithm ila = new Game.Attacking.InLineAlgorithm(attacker.X,
                                        
Xattacker.YY, (byte)spell.RangeInLineAlgorithm.Algorithm.DDA);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;
                                            
attacker.Owner.SendScreen(susetrue);
                                            
bool first false;
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
ila.InLine(attacked.Xattacked.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            continue;
                                                        if (
Kernel.GetDistance(attacked.Xattacked.Yattacker.Xattacker.Y) > 15) continue;
                                                        if (!
first)
                                                        {
                                                            var 
map Kernel.Maps[attacker.MapID];
                                                            
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
                                                            
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                                            while (
map.Npcs.ContainsKey(flooritem.UID))
                                                                
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                                            
flooritem.ItemID FloorItem.RageOfWarTrap;
                                                            
flooritem.attacked.X;
                                                            
flooritem.MapID map.ID;
                                                            
flooritem.attacked.Y;
                                                            
flooritem.MapObjType MapObjectType.FloorSpell;
                                                            
flooritem.Type FloorItem.Effect;
                                                            
flooritem.mColor 15;
                                                            
flooritem.OwnerUID attacker.UID;
                                                            
flooritem.OnFloor Time32.Now;
                                                            
flooritem.Owner attacker.Owner;
                                                            
flooritem.Name2 "RageofWarTrap";
                                                            
map.AddFloorItem(flooritem);
                                                            
attacker.Owner.SendScreenSpawn(flooritemtrue);
                                                            
first true;
                                                        }
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                        {
                                                            
damage = (uint)(damage 0.738);
                                                        }
                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                        {
                                                            
damage = (uint)(damage 0.700);
                                                        }
                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                        {
                                                            
damage = (uint)(damage 0.650);
                                                        }
                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                        {
                                                            
damage = (uint)(damage 0.600);
                                                        }
                                                        
attack.Damage damage;
                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
suse.AddTarget(attackeddamageattack);
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.Monster)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
ila.InLine(attacked.Xattacked.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            continue;
                                                        if (
Kernel.GetDistance(attacked.Xattacked.Yattacker.Xattacker.Y) > 11) continue;
                                                        if (!
first)
                                                        {
                                                            var 
map Kernel.Maps[attacker.MapID];
                                                            
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
                                                            
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                                            while (
map.Npcs.ContainsKey(flooritem.UID))
                                                                
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;

                                                            
flooritem.ItemID FloorItem.RageOfWarTrap;
                                                            
flooritem.attacked.X;
                                                            
flooritem.MapID map.ID;
                                                            
flooritem.attacked.Y;
                                                            
flooritem.Type FloorItem.Effect;
                                                            
flooritem.MapObjType MapObjectType.FloorSpell;
                                                            
flooritem.mColor 15;
                                                            
flooritem.OwnerUID attacker.UID;
                                                            
flooritem.OnFloor Time32.Now;
                                                            
flooritem.Owner attacker.Owner;
                                                            
flooritem.Name2 "RageofWarTrap";
                                                            
map.AddFloorItem(flooritem);
                                                            
attacker.Owner.SendScreenSpawn(flooritemtrue);
                                                            
first true;
                                                        }

                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedspellref attack);
                                                        
damage = (uint)(damage 1.0);

                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
suse.AddTarget(attackeddamageattack);
                                                    }


                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
attackedsob _obj as SobNpcSpawn;
                                                    if (
attackedsob == null) continue;
                                                    if (
ila.InLine(attackedsob.Xattackedsob.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedsobspell))
                                                            continue;
                                                        if (
Kernel.GetDistance(attackedsob.Xattackedsob.Yattacker.Xattacker.Y) > 11) continue;
                                                        if (!
first)
                                                        {
                                                            var 
map Kernel.Maps[attacker.MapID];
                                                            
Network.GamePackets.FloorItem flooritem = new Network.GamePackets.FloorItem(true);
                                                            
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                                            while (
map.Npcs.ContainsKey(flooritem.UID))
                                                                
flooritem.UID Network.GamePackets.FloorItem.FloorUID.Next;
                                                            
flooritem.MapObjType MapObjectType.FloorSpell;
                                                            
flooritem.ItemID FloorItem.RageOfWarTrap;
                                                            
flooritem.attackedsob.X;
                                                            
flooritem.MapID map.ID;
                                                            
flooritem.attackedsob.Y;
                                                            
flooritem.Type FloorItem.Effect;
                                                            
flooritem.mColor 15;
                                                            
flooritem.OwnerUID attacker.UID;
                                                            
flooritem.OnFloor Time32.Now;
                                                            
flooritem.Owner attacker.Owner;
                                                            
flooritem.Name2 "RageofWarTrap";
                                                            
map.AddFloorItem(flooritem);
                                                            
attacker.Owner.SendScreenSpawn(flooritemtrue);
                                                            
first true;
                                                        }

                                                        
uint damage = (uint)(Game.Attacking.Calculate.Melee(attackerattackedsobref attack) * (spell.Power 30000) / 450);

                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                        
suse.AddTarget(attackedsobdamageattack);
                                                    }


                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.AttackPacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #endregion
                                #region EpicWarrior
                                
case 12660:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#region Pounce
                                
case 12770:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
suse.SpellLevel spell.Level;
                                            
ushort _X attacker.X_Y attacker.Y;
                                            
ushort _tX X_tY Y;
                                            
byte dist = (byte)spell.Distance;
                                            var Array = 
attacker.Owner.Screen.Objects;
                                            
InLineAlgorithm algo = new InLineAlgorithm(attacker.XXattacker.YYdist,
                                                                               
InLineAlgorithm.Algorithm.DDA);
                                            
attacker.X;
                                            
attacker.Y;
                                            
int i 0;
                                            for (
0algo.lcoords.Counti++)
                                            {
                                                if (
attacker.Owner.Map.Floor[algo.lcoords[i].Xalgo.lcoords[i].YMapObjectType.Entity]
                                                    && !
attacker.ThroughGate(algo.lcoords[i].Xalgo.lcoords[i].Y))
                                                {
                                                    
= (ushort)algo.lcoords[i].X;
                                                    
= (ushort)algo.lcoords[i].Y;
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                            }
                                            
suse.X;
                                            
suse.Y;
                                            if (!
attacker.Owner.Map.Floor[XYMapObjectType.Entitynull])
                                                return;
                                            
double disth 1.5;

                                            foreach (
Interfaces.IMapObject _obj in Array)
                                            {
                                                
bool hit false;
                                                for (
int j 0ij++)
                                                    if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                        
hit true;
                                                if (
hit)
                                                {
                                                    if (
_obj.MapObjType == MapObjectType.Monster)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Melee(attackerattackedspellref attackclient_Spell.LevelHu2);
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                            
damage = (uint)(damage 1.100);
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);

                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.X;
                                            
attacker.Y;
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.Owner.Screen.Reload(suse);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region ManiacDance
                                
case 12700:
                                    {

                                        if (
attacker.ContainsFlag(Update.Flags.XPList))
                                        {
                                            
attacker.RemoveFlag(Update.Flags.XPList);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;

                                            
attacker.ManiacDanceStamp Time32.Now;
                                            
attacker.AddFlag3(Update.Flags3.WaniacDance);
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region BackFire
                                
case 12680:
                                    if (
attacker.Stamina >= 10)
                                        
attacker.Stamina -= 10;
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
attack.Attacker attack.Attacked attacker.UID;
                                            
attack.attacker.X;
                                            
attack.attacker.Y;
                                            
attack.AttackType 24;
                                            
attack.Damage 3000;
                                            
attacker.Owner.SendScreen(attacktrue);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
attacker.BackFireStamp Time32.Now;
                                            
attacker.AddFlag3(Update.Flags3.BackFire);
                                            if (
attacker.Stamina <= 70attacker.Stamina += 30;
                                            else 
attacker.Stamina 100;
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region WaveofBlood
                                
case 12690:
                                    {
                                        if (
Time32.Now >= attacker.SpellStamp.AddMilliseconds(1300))
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);

                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
suse.SpellLevel spell.Level;
                                                
suse.X;
                                                
suse.Y;
                                                
Sector sector = new Sector(attacker.Xattacker.YXY);
                                                
sector.Arrange(spell.Sectorspell.Range);
                                                if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Distance 1)
                                                {
                                                    foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                    {
                                                        
byte dist = (byte)spell.Distance;
                                                        
InLineAlgorithm algo = new InLineAlgorithm(attacker.XXattacker.YYdistInLineAlgorithm.Algorithm.DDA);
                                                        
int i algo.lcoords.Count;
                                                        
double disth 3.0;
                                                        if (
_obj == null)
                                                            continue;
                                                        if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                        {
                                                            
bool hit false;
                                                            for (
int j 0ij++)
                                                                if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                                    
hit true;
                                                            if (
hit)
                                                            {
                                                                
attacked _obj as Entity;

                                                                if (
sector.Inside(attacked.Xattacked.Y))
                                                                {
                                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                        {
                                                                            
damage = (uint)(damage 0.644);
                                                                        }
                                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                        {
                                                                            
damage = (uint)(damage 0.644);
                                                                        }
                                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                        {
                                                                            
damage = (uint)(damage 0.633);
                                                                        }
                                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                                        {
                                                                            
damage = (uint)(damage 0.622);
                                                                        }
                                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
                                                                        {
                                                                            
damage = (uint)(damage 0.619);
                                                                        }
                                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
                                                                        {
                                                                            
damage = (uint)(damage 0.615);
                                                                        }
                                                                        if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                                        {
                                                                            
damage = (uint)(damage 0.611);
                                                                        }

                                                                        
suse.Effect1 attack.Effect1;
                                                                        
ReceiveAttack(attackerattackedattackref damagespell);
                                                                        
suse.AddTarget(attackeddamageattack);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                        else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                        {
                                                            
bool hit false;
                                                            for (
int j 0ij++)
                                                                if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                                    
hit true;
                                                            if (
hit)
                                                            {
                                                                
attackedsob _obj as SobNpcSpawn;

                                                                if (
sector.Inside(attackedsob.Xattackedsob.Y))
                                                                {
                                                                    if (
CanAttack(attackerattackedsobspell))
                                                                    {
                                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                        
// damage = (damage * 75) / 100;
                                                                        
damage = (damage 75) / 100;
                                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                        
suse.AddTarget(attackedsobdamageattack);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }   
                                                else
                                                {
                                                    
attacker.AttackPacket null;
                                                }
                                                
byte seconds 8;
                                                if (
Time32.Now >= attacker.AngerCooldown.AddSeconds(seconds))
                                                {
                                                    
attacker.AngerCooldown Time32.Now;
                                                    
attacker.Update(90secondsfalse);
                                                }
                                                
attacker.Owner.SendScreen(susetrue);
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region New Ninja By Phoenix
                                #region TwilightDance
                                
case 12070:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
// suse.Attacker1 = attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;

                                            
TwilightAction(attackersusespellXY);

                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.AttackPacket null;

                                        }
                                        break;
                                    }
                                
#endregion
                                #region SuperTwofoldBlade
                                
case 12080:
                                    {
                                        if (
Time32.Now >= attacker.SpellStamp.AddMilliseconds(1030))
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
ushort XxYx;
                                                if (
attacked != null)
                                                {
                                                    
Xx attacked.X;
                                                    
Yx attacked.Y;
                                                }
                                                else
                                                {
                                                    
Xx attackedsob.X;
                                                    
Yx attackedsob.Y;
                                                }
                                                if (
Kernel.GetDistance(attacker.Xattacker.YXxYx) <= spell.Distance)
                                                {
                                                    if (
attackedsob == null)
                                                        if (
attacked.ContainsFlag(Update.Flags.Fly))
                                                            return;
                                                    if (
attacker.ContainsFlag(Update.Flags.Fly))
                                                        return;
                                                    
PrepareSpell(spellattacker.Owner);

                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;
                                                    
bool send false;

                                                    if (
attackedsob == null)
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                            {
                                                                
damage = (uint)(damage 0.950);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                            {
                                                                
damage = (uint)(damage 0.944);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                            {
                                                                
damage = (uint)(damage 0.933);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                            {
                                                                
damage = (uint)(damage 0.900);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
                                                            {
                                                                
damage = (uint)(damage 0.880);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
                                                            {
                                                                
damage = (uint)(damage 0.770);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                            {
                                                                
damage = (uint)(damage 0.766);
                                                            }


                                                            
suse.Effect1 attack.Effect1;
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                            
send true;

                                                            if (
attacker.Owner.Spells.ContainsKey(0) && !attacked.Dead)
                                                            {
                                                                var 
attacker.Owner.Spells[0];
                                                                var 
spellz Database.SpellTable.SpellInformations[s.ID][s.Level];
                                                                if (
spellz != null)
                                                                {
                                                                    if (
Kernel.Rate(spellz.Percent))
                                                                    {
                                                                        
SpellUse ssuse = new SpellUse(true);
                                                                        
ssuse.Attacker attacker.UID;
                                                                        
ssuse.SpellID spellz.ID;

                                                                        
ssuse.SpellLevel spellz.Level;
                                                                        
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                                        
ssuse.AddTarget(attacked, new SpellUse.DamageClass().Damage damageattack);
                                                                        
ReceiveAttack(attackerattackedattackref damagespell);
                                                                        
attacker.Owner.SendScreen(ssusetrue);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                            
damage = (uint)(damage 110 110);
                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);
                                                            
suse.Effect1 attack.Effect1;

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                            
send true;
                                                        }
                                                    }
                                                    if (
send)
                                                        
attacker.Owner.SendScreen(susetrue);
                                                    
attacker.SpellStamp Time32.Now;
                                                }
                                                else
                                                {
                                                    
attacker.AttackPacket null;
                                                }
                                            }
                                        }
                                        break;
                                    }


                                
#endregion
                                #region ShadowClone
                                /*case 12090:
                                    {
                                        if (attacker.Owner.Map.ID == 6565 || attacker.Owner.Map.ID == 5555 || attacker.Owner.Map.ID == 2014)
                                        {
                                            Kernel.SendWorldMessage(new Message("Mr: " + attacker.Name + " You Can`t Use ThisSpell Here !!!", System.Drawing.Color.Red, Message.Talk), Program.Values);
                                            return;
                                        }
                                        if (attacker.Owner.Map.ID == 6565 || attacker.Owner.Map.ID == 5555 || attacker.Owner.Map.ID == 2014)
                                        {
                                            Kernel.SendWorldMessage(new Message("Mr: " + attacker.Name + " You Can`t Use ThisSpell Here !!!", System.Drawing.Color.Red, Message.Talk), Program.Values);
                                            return;
                                        }
                                        attacker.AttackPacket = null;
                                        if (attacker.MyClones.Count > 0)
                                        {
                                            var clones = attacker.MyClones.Values.ToArray();
                                            for (int i = 0; i < clones.Length; i++)
                                            {
                                                var item = clones[i];
                                                if (item == null)
                                                    continue;
                                                Data data = new Data(true);
                                                data.UID = item.UID;
                                                data.ID = Network.GamePackets.Data.RemoveEntity;
                                                attacker.Owner.SendScreen(data);
                                                //  attacker.MyClones[item.UID] = null;
                                            }
                                            attacker.MyClones.Clear();
                                        }
                                        else
                                        {
                                            if (CanUseSpell(spell, attacker.Owner))
                                            {
                                                PrepareSpell(spell, attacker.Owner);
                                                SpellUse spellUse = new SpellUse(true);
                                                spellUse.Attacker = attacker.UID;
                                                spellUse.SpellID = spell.ID;
                                                spellUse.SpellLevel = spell.Level;
                                                spellUse.X = X;
                                                spellUse.Y = Y;
                                                attacker.AddClone(3);
                                                if (spell.Level >= 0)
                                                    attacker.AddClone(0);
                                                foreach (var item in attacker.MyClones.Values)
                                                    spellUse.AddTarget(item, 0, attack);

                                                attacker.Owner.SendScreen(spellUse, true);
                                            }

                                        }
                                        break;
                                    }*/
                                #endregion
                                #region FatalSpin
                                
case 12110:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
                                        
Xattacker.YY, (byte)spell.DistanceInLineAlgorithm.Algorithm.DDA);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
foreach (Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
ila.InLine(attacked.Xattacked.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            continue;

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        var 
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                        
damage = (uint)(damage 1.100);
                                                        
suse.Effect1 attack.Effect1;

                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
suse.AddTarget(attackeddamageattack);
                                                    }
                                                }
                                                else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                {
                                                    
attackedsob _obj as SobNpcSpawn;

                                                    if (
ila.InLine(attackedsob.Xattackedsob.Y))
                                                    {
                                                        if (!
CanAttack(attackerattackedsobspell))
                                                            continue;

                                                        
attack.Effect1 Attack.AttackEffects1.None;
                                                        
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                        
damage = (damage 2);
                                                        
attack.Damage damage;

                                                        
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                        
suse.AddTarget(attackedsobdamageattack);
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region LeeLong

                                #region DragonFlow
                                
case 12270:
                                    {

                                        
SpellUse spellUse = new SpellUse(true);
                                        
spellUse.Attacker attacker.UID;
                                        
spellUse.Attacker1 attacker.UID;
                                        
spellUse.SpellID spell.ID;
                                        
spellUse.SpellLevel spell.Level;
                                        
spellUse.X;
                                        
spellUse.Y;
                                        
spellUse.AddTarget(attacker1attack);
                                        
attacker.Owner.SendScreen(spellUsetrue);
                                        if (
attacker.ContainsFlag3((uint)Update.Flags3.DragonFlow))
                                            
attacker.RemoveFlag3((uint)Update.Flags3.DragonFlow);
                                        else
                                            
attacker.AddFlag3((uint)Update.Flags3.DragonFlow);
                                        
attacker.DragonFlowStamp attacker.DragonFlowStamp2 Time32.Now;
                                        break;
                                    }
                                
#endregion
                                #region DragonRoar
                                
case 12280:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
PrepareSpell(spellattacker.Owner);
                                            if (
attacker.Owner.Team != null)
                                            {
                                                foreach (
Client.GameState teammate in attacker.Owner.Team.Teammates)
                                                {
                                                    if (
teammate.Player.UID != attacker.UID)
                                                    {
                                                        if (
Kernel.GetDistance(attacker.Xattacker.Yteammate.Player.Xteammate.Player.Y) <= spell.Range)
                                                        {
                                                            
teammate.Player.Stamina += (byte)spell.Power;
                                                            
suse.AddTarget(teammate.Playerspell.Powernull);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region DragonCyclone
                                
case 12290:
                                    {
                                        
SpellUse suse = new SpellUse(true);
                                        
suse.Attacker attacker.UID;
                                        
suse.SpellID spell.ID;
                                        
suse.SpellLevel spell.Level;
                                        
suse.X;
                                        
suse.Y;
                                        if (
attacker.ContainsFlag(Update.Flags.XPList))
                                        {
                                            
attacker.RemoveFlag(Update.Flags.XPList);
                                            
attacker.AddFlag3(Update.Flags3.DragonCyclone);
                                            
attacker.DragonCycloneStamp Time32.Now;
                                            
attacker.Owner.SendScreen(susetrue);

                                        }
                                        else
                                        {
                                            
ushort _X attacker.X_Y attacker.Y;
                                            
ushort _tX X_tY Y;
                                            
byte dist = (byte)spell.Distance;
                                            var Array = 
attacker.Owner.Screen.Objects;
                                            
InLineAlgorithm algo = new InLineAlgorithm(attacker.XXattacker.YYdist,
                                                                               
InLineAlgorithm.Algorithm.DDA);
                                            
attacker.X;
                                            
attacker.Y;
                                            
int i 0;
                                            for (
0algo.lcoords.Counti++)
                                            {
                                                if (
attacker.Owner.Map.Floor[algo.lcoords[i].Xalgo.lcoords[i].YMapObjectType.Entity]
                                                    && !
attacker.ThroughGate(algo.lcoords[i].Xalgo.lcoords[i].Y))
                                                {
                                                    
= (ushort)algo.lcoords[i].X;
                                                    
= (ushort)algo.lcoords[i].Y;
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                            }
                                            
suse.X;
                                            
suse.Y;
                                            if (!
attacker.Owner.Map.Floor[XYMapObjectType.Entitynull])
                                                return;
                                            
double disth 1.5;
                                            
//   if (attacker.MapID == DeathMatch.MAPID) disth = 1;
                                            
foreach (Interfaces.IMapObject _obj in Array)
                                            {
                                                
bool hit false;
                                                for (
int j 0ij++)
                                                    if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                        
hit true;
                                                if (
hit)
                                                {
                                                    if (
_obj.MapObjType == MapObjectType.Monster)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                            {
                                                                
damage = (uint)(damage 0.500);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                            {
                                                                
damage = (uint)(damage 0.450);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                            {
                                                                
damage = (uint)(damage 0.420);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                            {
                                                                
damage = (uint)(damage 0.390);
                                                            }
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);

                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.PX attacker.X;
                                            
attacker.PY attacker.Y;
                                            
attacker.X;
                                            
attacker.Y;
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.Owner.Screen.Reload(suse);

                                        }
                                        break;
                                    }
                                
#endregion
                                #region DragonSlash
                                
case 12350:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
                                        
Xattacker.YY, (byte)spell.RangeInLineAlgorithm.Algorithm.DDA);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.Attacker1 attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
ila.InLine(attacked.Xattacked.Y))
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                            {
                                                                
damage = (uint)(damage 0.990);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                            {
                                                                
damage = (uint)(damage 0.955);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                            {
                                                                
damage = (uint)(damage 0.899);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                            {
                                                                
damage = (uint)(damage 0.888);
                                                            }
                                                            
suse.Effect1 attack.Effect1;

                                                            
attack.Damage damage;

                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;

                                                        if (
ila.InLine(attackedsob.Xattackedsob.Y))
                                                        {
                                                            if (!
CanAttack(attackerattackedsobspell))
                                                                continue;

                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                            
attack.Damage damage;

                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region AirKick
                                
case 12320:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
suse.SpellLevel spell.Level;
                                            
ushort _X attacker.X_Y attacker.Y;
                                            
ushort _tX X_tY Y;
                                            
byte dist = (byte)spell.Distance;
                                            var Array = 
attacker.Owner.Screen.Objects;
                                            
InLineAlgorithm algo = new InLineAlgorithm(attacker.XXattacker.YYdist,
                                                                               
InLineAlgorithm.Algorithm.DDA);
                                            
attacker.X;
                                            
attacker.Y;
                                            
int i 0;
                                            for (
0algo.lcoords.Counti++)
                                            {
                                                if (
attacker.Owner.Map.Floor[algo.lcoords[i].Xalgo.lcoords[i].YMapObjectType.Entity]
                                                    && !
attacker.ThroughGate(algo.lcoords[i].Xalgo.lcoords[i].Y))
                                                {
                                                    
= (ushort)algo.lcoords[i].X;
                                                    
= (ushort)algo.lcoords[i].Y;
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                            }
                                            
suse.X;
                                            
suse.Y;
                                            if (!
attacker.Owner.Map.Floor[XYMapObjectType.Entitynull])
                                                return;
                                            
double disth 0.5;

                                            foreach (
Interfaces.IMapObject _obj in Array)
                                            {
                                                
bool hit false;
                                                for (
int j 0ij++)
                                                    if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                        
hit true;
                                                if (
hit)
                                                {
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                            {
                                                                
damage = (uint)(damage 0.510);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                            {
                                                                
damage = (uint)(damage 0.500);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                            {
                                                                
damage = (uint)(damage 0.490);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                            {
                                                                
damage = (uint)(damage 0.480);
                                                            }
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);

                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.PX attacker.X;
                                            
attacker.PY attacker.Y;
                                            
attacker.X;
                                            
attacker.Y;
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.Owner.Screen.Reload(suse);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region AirSweep and AirRaid
                                
case 12330:
                                case 
12210:
                                case 
12340:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);

                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
suse.SpellLevel spell.Level;
                                            
suse.X;
                                            
suse.Y;
                                            
Sector sector = new Sector(attacker.Xattacker.YXY);
                                            
sector.Arrange(spell.Sectorspell.Range);
                                            if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= spell.Range)
                                            {
                                                foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                {
                                                    if (
_obj == null)
                                                        continue;
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;

                                                        if (
sector.Inside(attacked.Xattacked.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                {
                                                                    
damage = (uint)(damage 0.510);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                {
                                                                    
damage = (uint)(damage 0.495);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                {
                                                                    
damage = (uint)(damage 0.490);
                                                                }
                                                                if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                                {
                                                                    
damage = (uint)(damage 0.480);
                                                                }
                                                                
suse.Effect1 attack.Effect1;

                                                                
ReceiveAttack(attackerattackedattackref damagespell);

                                                                
suse.AddTarget(attackeddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;

                                                        if (
sector.Inside(attackedsob.Xattackedsob.Y))
                                                        {
                                                            if (
CanAttack(attackerattackedsobspell))
                                                            {
                                                                
attack.Effect1 Attack.AttackEffects1.None;
                                                                
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                
suse.AddTarget(attackedsobdamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.AttackPacket null;
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Speed Kick
                                
case 12120:
                                case 
12130:
                                case 
12140:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID spell.ID;
                                            
//suse.SpellLevelHu = client_Spell.LevelHu2;
                                            
suse.SpellLevel spell.Level;
                                            
ushort _X attacker.X_Y attacker.Y;
                                            
ushort _tX X_tY Y;
                                            
byte dist = (byte)spell.Distance;
                                            var Array = 
attacker.Owner.Screen.Objects;
                                            
InLineAlgorithm algo = new InLineAlgorithm(attacker.XXattacker.YYdist,
                                                                               
InLineAlgorithm.Algorithm.DDA);
                                            
attacker.X;
                                            
attacker.Y;
                                            
int i 0;
                                            for (
0algo.lcoords.Counti++)
                                            {
                                                if (
attacker.Owner.Map.Floor[algo.lcoords[i].Xalgo.lcoords[i].YMapObjectType.Entity]
                                                    && !
attacker.ThroughGate(algo.lcoords[i].Xalgo.lcoords[i].Y))
                                                {
                                                    
= (ushort)algo.lcoords[i].X;
                                                    
= (ushort)algo.lcoords[i].Y;
                                                }
                                                else
                                                {
                                                    break;
                                                }
                                            }
                                            
suse.X;
                                            
suse.Y;
                                            if (!
attacker.Owner.Map.Floor[XYMapObjectType.Entitynull])
                                                return;
                                            
double disth 1.5;
                                            foreach (
Interfaces.IMapObject _obj in Array)
                                            {
                                                
bool hit false;
                                                for (
int j 0ij++)
                                                    if (
Kernel.GetDDistance(_obj.X_obj.Y, (ushort)algo.lcoords[j].X, (ushort)algo.lcoords[j].Y) <= disth)
                                                        
hit true;
                                                if (
hit)
                                                {
                                                    if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                    {
                                                        
attacked _obj as Entity;
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                            {
                                                                
damage = (uint)(damage 0.510);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                            {
                                                                
damage = (uint)(damage 0.500);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                            {
                                                                
damage = (uint)(damage 0.490);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                            {
                                                                
damage = (uint)(damage 0.480);
                                                            }
                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;
                                                        if (
CanAttack(attackerattackedsobspell))
                                                        {
                                                            var 
damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);

                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.PX attacker.X;
                                            
attacker.PY attacker.Y;
                                            
attacker.X;
                                            
attacker.Y;
                                            
attacker.Owner.SendScreen(susetrue);
                                            
attacker.Owner.Screen.Reload(suse);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Cracking swipe
                                
case 12170:
                                case 
12160:
                                    {
                                        if (
Time32.Now >= attacker.SpellStamp.AddMilliseconds(5))
                                        {
                                            if (
CanUseSpell(spellattacker.Owner))
                                            {
                                                
PrepareSpell(spellattacker.Owner);

                                                
SpellUse suse = new SpellUse(true);
                                                
suse.Attacker attacker.UID;
                                                
suse.SpellID spell.ID;
                                                
suse.SpellLevel spell.Level;
                                                
suse.X;
                                                
suse.Y;
                                                
Fan sector = new Fan(attacker.Xattacker.YXYspell.Rangespell.Sector);
                                                if (
Kernel.GetDistance(attacker.Xattacker.YXY) <= 15)
                                                {
                                                    foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                                    {
                                                        if (
_obj == null)
                                                            continue;
                                                        if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                        {
                                                            
attacked _obj as Entity;

                                                            if (
sector.IsInFan(attacked.Xattacked.Y))
                                                            {
                                                                if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                                {
                                                                    
attack.Effect1 Attack.AttackEffects1.None;
                                                                    
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                                    {
                                                                        
damage = (uint)(damage 0.680);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                                    {
                                                                        
damage = (uint)(damage 0.680);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                                    {
                                                                        
damage = (uint)(damage 0.655);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                                    {
                                                                        
damage = (uint)(damage 0.644);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Baron)
                                                                    {
                                                                        
damage = (uint)(damage 0.633);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Knight)
                                                                    {
                                                                        
damage = (uint)(damage 0.622);
                                                                    }
                                                                    if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Serf)
                                                                    {
                                                                        
damage = (uint)(damage 0.611);
                                                                    }

                                                                    
suse.Effect1 attack.Effect1;
                                                                    
suse.Effect1 attack.Effect1;
                                                                    
ReceiveAttack(attackerattackedattackref damagespell);
                                                                    
suse.AddTarget(attackeddamageattack);
                                                                }
                                                            }
                                                        }
                                                        else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                        {
                                                            
attackedsob _obj as SobNpcSpawn;

                                                            if (
sector.IsInFan(attackedsob.Xattackedsob.Y))
                                                            {
                                                                if (
CanAttack(attackerattackedsobspell))
                                                                {
                                                                    
attack.Effect1 Attack.AttackEffects1.None;
                                                                    
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                                    
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                                    
suse.AddTarget(attackedsobdamageattack);
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    
attacker.AttackPacket null;
                                                }
                                                
attacker.Owner.SendScreen(susetrue);
                                                
attacker.SpellStamp Time32.Now;
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region Dragon Punch
                                
case 12240:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
Game.Attacking.InLineAlgorithm ila = new Mr_Panda.Game.Attacking.InLineAlgorithm(attacker.X,
                                        
Xattacker.YY, (byte)spell.RangeInLineAlgorithm.Algorithm.DDA);
                                            
SpellUse suse = new SpellUse(true);
                                            
suse.Attacker attacker.UID;
                                            
suse.SpellID SpellID;
                                            
suse.SpellLevel attacker.Owner.Spells[SpellID].Level;
                                            
suse.X;
                                            
suse.Y;
                                            foreach (
Interfaces.IMapObject _obj in attacker.Owner.Screen.Objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.MapObjType == MapObjectType.Monster || _obj.MapObjType == MapObjectType.Entity)
                                                {
                                                    
attacked _obj as Entity;
                                                    if (
ila.InLine(attacked.Xattacked.Y))
                                                    {
                                                        if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                        {
                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedref attack);

                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.King)
                                                            {
                                                                
damage = (uint)(damage 1.100);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Prince)
                                                            {
                                                                
damage = (uint)(damage 1.200);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Duke)
                                                            {
                                                                
damage = (uint)(damage 1.300);
                                                            }
                                                            if (
attacker.NobilityRank == Mr_Panda.Game.ConquerStructures.NobilityRank.Earl)
                                                            {
                                                                
damage = (uint)(damage 1.200);
                                                            }
                                                            
suse.Effect1 attack.Effect1;

                                                            
attack.Damage damage;

                                                            
ReceiveAttack(attackerattackedattackref damagespell);

                                                            
suse.AddTarget(attackeddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.MapObjType == MapObjectType.SobNpc)
                                                    {
                                                        
attackedsob _obj as SobNpcSpawn;

                                                        if (
ila.InLine(attackedsob.Xattackedsob.Y))
                                                        {
                                                            if (!
CanAttack(attackerattackedsobspell))
                                                                continue;

                                                            
attack.Effect1 Attack.AttackEffects1.None;
                                                            
uint damage Game.Attacking.Calculate.Melee(attackerattackedsobref attack);
                                                            
attack.Damage damage;

                                                            
ReceiveAttack(attackerattackedsobattackdamagespell);

                                                            
suse.AddTarget(attackedsobdamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.Owner.SendScreen(susetrue);
                                        }
                                        break;
                                    }

                                
#endregion
                                #region DragonFury
                                
case 12220:
                                    {
                                        if (
attacked != null)
                                        {
                                            if (
Kernel.GetDistance(attacker.Xattacker.Yattacked.Xattacked.Y) <= spell.Distance)
                                            {
                                                if (
CanUseSpell(spellattacker.Owner))
                                                {
                                                    
SpellUse suse = new SpellUse(true);
                                                    
suse.Attacker attacker.UID;
                                                    
suse.SpellID spell.ID;
                                                    
suse.SpellLevel spell.Level;
                                                    
suse.X;
                                                    
suse.Y;

                                                    if (
CanAttack(attackerattackedspellattack.AttackType == Attack.Melee))
                                                    {
                                                        
PrepareSpell(spellattacker.Owner);
                                                        
attack.Effect1 Attack.AttackEffects1.None;

                                                        var 
damage Game.Attacking.Calculate.Melee(attackerattackedref attack);
                                                        
damage = (uint)(damage 1.100);
                                                        
suse.Effect1 attack.Effect1;

                                                        
ReceiveAttack(attackerattackedattackref damagespell);

                                                        
suse.AddTarget(attackeddamageattack);
                                                        
attacker.Owner.Player.IsEagleEyeShooted true;

                                                        if (
attacked.EntityFlag == EntityFlag.Entity)
                                                            
attacked.Owner.SendScreen(susetrue);
                                                        else
                                                            
attacked.MonsterInfo.SendScreen(suse);
                                                        if (
attacked.EntityFlag == EntityFlag.Entity)
                                                        {
                                                            
int potDifference attacker.BattlePower attacked.BattlePower;

                                                            
int rate spell.Percent potDifference 20;
                                                            if (
Kernel.Rate(rate))
                                                            {

                                                                
attacked.AddFlag3(Update.Flags3.DragonFury);
                                                                
attacked.DragonFuryStamp Time32.Now;
                                                                
attacked.DragonFuryTime spell.Duration;

                                                                
Network.GamePackets.Update upgrade = new Network.GamePackets.Update(true);
                                                                
upgrade.UID attacked.UID;
                                                                
upgrade.Append(74
                                                                    
, (uint)spell.Status
                                                                    
, (uint)spell.Durationspell.Powerspell.Level);
                                                                
attacker.Owner.Send(upgrade.ToArray());

                                                                if (
attacked.EntityFlag == EntityFlag.Entity)
                                                                    
attacked.Owner.Send(upgrade);
                                                                else
                                                                    
attacked.MonsterInfo.SendScreen(upgrade);
                                                            }
                                                        }

                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region DragonSwing
                                
case 12200:
                                    {
                                        if (
CanUseSpell(spellattacker.Owner))
                                        {
                                            
PrepareSpell(spellattacker.Owner);
                                            
SpellUse spellUse = new SpellUse(true);
                                            
spellUse.Attacker attacker.UID;
                                            
spellUse.SpellID spell.ID;
                                            
spellUse.SpellLevel spell.Level;
                                            
spellUse.X;
                                            
spellUse.Y;
                                            
attacker.Owner.SendScreen(spellUsetrue);
                                            if (
attacker.OnDragonSwing)
                                            {
                                                
attacker.OnDragonSwing false;
                                                
attacker.RemoveFlag3(Update.Flags3.DragonSwing);
                                                
Update upgrade = new Update(true);
                                                
upgrade.UID attacker.UID;
                                                
upgrade.Append(Update.DragonSwing, (uint)spell.Status000);
                                                
attacker.Owner.Send(upgrade.ToArray());
                                            }
                                            else
                                            {
                                                
attacker.OnDragonSwing true;
                                                
attacker.DragonSwingPower spell.Level;
                                                
attacker.AddFlag3(Update.Flags3.DragonSwing);
                                                
Update upgrade = new Update(true);
                                                
upgrade.UID attacker.UID;
                                                
upgrade.Append(Update.DragonSwing, (uint)spell.Duration, (uint)spell.Statusspell.Powerspell.Level);
                                                
attacker.Owner.Send(upgrade.ToArray());
                                                
attacker.DragonSwingStamp Time32.Now;
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion

                                
default:
                                    {
                                        if (
attacker.Owner.Account.State == Mr_Panda.Database.AccountTable.AccountState.ProjectManager)
                                            
attacker.Owner.Send(new Message("Unknown Skill : " spellIDSystem.Drawing.Color.CadetBlueMessage.Talk));
                                        break;
                                    }
                            }
                            
attacker.Owner.IncreaseSpellExperience(ExperiencespellID);
                            if (
attacked != null && attacked.EntityFlag == EntityFlag.Monster && attacked.Hitpoints != 0)
                            {
                                
Update update = new Update(true);
                                
update.UID attacked.UID;
                                
update.Append(Update.MaxHitpointsattacked.MaxHitpoints);
                                
update.Append(Update.Hitpointsattacked.Hitpoints);
                                foreach (
Client.GameState client in Program.GamePool)
                                {
                                    if (
client.Map.ID == attacked.MapID)
                                    {
                                        if (
Kernel.GetDistance(client.Player.Xclient.Player.Yattacked.Xattacked.Y) < Constants.nScreenDistance)
                                        {
                                            
client.Send(update);
                                        }
                                    }
                                }
                            }
                            if (
attacker.MapID == 1039)
                            {
                                if (
spell.ID == 7001 || spell.ID == 9876)
                                {
                                    
attacker.AttackPacket null;
                                    return;
                                }
                                if (
attacker.AttackPacket != null)
                                {
                                    
attack.Damage spell.ID;
                                    
attacker.AttackPacket attack;
                                    var 
xspell GetWeaponSpell(spell);
                                    
//  var xspell = Database.SpellTable.WeaponSpells.Values.Where(p => p.Contains(spell.ID));
                                    
if (xspell != null)
                                    {
                                        if (
attacker.AttackPacket == null)
                                        {
                                            
attack.AttackType Attack.Melee;
                                            
attacker.AttackPacket attack;
                                        }
                                        else
                                        {
                                            
attacker.AttackPacket.AttackType Attack.Melee;
                                        }
                                    }
                                }
                            }
                            else
                            {
                                if (
spell.NextSpellID != 0)
                                {
                                    if (
spell.NextSpellID >= 1000 && spell.NextSpellID <= 1002)
                                        if (
Target >= 1000000)
                                        {
                                            
attacker.AttackPacket null;
                                            return;
                                        }
                                    
attack.Damage spell.NextSpellID;
                                    
attacker.AttackPacket attack;
                                }
                                else
                                {
                                    var 
xspell GetWeaponSpell(spell);//Database.SpellTable.WeaponSpells.Values.Where(p => p.Contains(spell.ID));
                                    
if (xspell == null || spell.ID == 9876)
                                        
attacker.AttackPacket null;
                                    else
                                    {
                                        if (
attacker.AttackPacket == null)
                                        {
                                            
attack.AttackType Attack.Melee;
                                            
attacker.AttackPacket attack;
                                        }
                                        else
                                        {
                                            
attacker.AttackPacket.AttackType Attack.Melee;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            
attacker.AttackPacket null;
                        }
                        if (
attacker.AttackPacket == null)
                        {
                            if (
spell.ID == 11960)
                                return;
                            if (
attacker.Owner.Spells.ContainsKey(11960))
                            {
                                if (
spell.ID == 9876 || spell.ID == 6002 || spell.ID == 10315 || spell.ID == 10311 || spell.ID == 10313 ||
               
spell.ID == 6003 || spell.ID == 10405 || spell.ID == 30000 || spell.ID == 10310 || spell.ID == 3050 ||
               
spell.ID == 3060 || spell.ID == 3080 || spell.ID == 3090)
                                    return;
                                
//if (Kernel.Rate(30))
                                
{
                                    
attack.AttackType Attack.Magic;
                                    
attack.Decoded true;
                                    
attack.attacker.X;
                                    
attack.attacker.Y;
                                    
attack.Attacked attacker.UID;
                                    
attack.Attacker attacker.UID;
                                    
attack.Damage 11960;
                                    goto 
restart;
                                }
                            }
                        }
                    }
                    
#endregion
                
}
                
#endregion
            
}
            
#endregion
        
}
        private 
void InfernalAction(Entity attackerSpellUse suseSpellInformation spellushort Xushort Y)
        {
            var 
map attacker.Owner.Map;
            
Point p1 = new Point() { attacker.Xattacker.};
            
Point p2 = new Point() { attacker.5attacker.};
            
Point p3 = new Point() { attacker.4attacker.};
            
Point p4 = new Point() { attacker.5attacker.};
            
/////////////////////// 
            
FloorItem floorItem = new FloorItem(true);

            
floorItem.ItemID FloorItem.Infernal;

            
floorItem.MapID attacker.MapID;
            
floorItem.Type FloorItem.Effect;
            
floorItem.= (ushort)(p1.X);
            
floorItem.= (ushort)(p1.Y);
            
floorItem.OnFloor Time32.Now;
            
floorItem.Owner attacker.Owner;
            
//while (map.Npcs.ContainsKey(floorItem.UID)) 
            //    floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next; 
            //map.AddFloorItem(floorItem); 
            /////////////////////////////////////////////// 
            //attacker.Owner.SendScreenSpawn(floorItem, true); 
            
FloorItem floorItem2 = new FloorItem(true);

            
floorItem2.ItemID FloorItem.Infernal;
            
floorItem2.MapID attacker.MapID;
            
floorItem2.Type FloorItem.Effect;
            
floorItem2.= (ushort)(p2.X);
            
floorItem2.= (ushort)(p2.Y);
            
floorItem2.OnFloor Time32.Now;
            
floorItem2.Owner attacker.Owner;
            
//while (map.Npcs.ContainsKey(floorItem2.UID)) 
            //    floorItem2.UID = Network.GamePackets.FloorItem.FloorUID.Next; 
            //map.AddFloorItem(floorItem2); 
            // attacker.Owner.SendScreenSpawn(floorItem2, true); 
            /////////////////////////////////////////////// 
            
FloorItem floorItem3 = new FloorItem(true);

            
floorItem3.ItemID FloorItem.Infernal;
            
floorItem3.MapID attacker.MapID;
            
floorItem3.Type FloorItem.Effect;
            
floorItem3.= (ushort)(p3.X);
            
floorItem3.= (ushort)(p3.Y);
            
floorItem3.OnFloor Time32.Now;
            
floorItem3.Owner attacker.Owner;
            
//while (map.Npcs.ContainsKey(floorItem3.UID)) 
            //    floorItem3.UID = Network.GamePackets.FloorItem.FloorUID.Next; 
            //map.AddFloorItem(floorItem3); 
            // attacker.Owner.SendScreenSpawn(floorItem3, true); 
            //////////////////////////////////////////// 
            
FloorItem floorItem4 = new FloorItem(true);

            
floorItem4.ItemID FloorItem.Infernal;
            
floorItem4.MapID attacker.MapID;
            
floorItem4.Type FloorItem.Effect;
            
floorItem4.= (ushort)(p4.X);
            
floorItem4.= (ushort)(p4.Y);
            
floorItem4.OnFloor Time32.Now;
            
floorItem4.Owner attacker.Owner;
            
//while (map.Npcs.ContainsKey(floorItem4.UID)) 
            //    floorItem4.UID = Network.GamePackets.FloorItem.FloorUID.Next; 
            //map.AddFloorItem(floorItem4); 
            //   attacker.Owner.SendScreenSpawn(floorItem4, true); 
            ///////////////////////////////// 
            
attacker.Owner.SendScreenSpawn(floorItemtrue);
            
attacker.Owner.SendScreenSpawn(floorItem2true);
            
attacker.Owner.SendScreenSpawn(floorItem3true);
            
attacker.Owner.SendScreenSpawn(floorItem4true);
        }
        public static 
void HandleAura(Game.Entity attackerDatabase.SpellInformation spell)
        {
            
ulong statusFlag 0;
            
ulong statusFlag2 0;
            
Update.AuraType aura Update.AuraType.TyrantAura;
            switch (
spell.ID)
            {
                case 
10424statusFlag Update.Flags2.EarthAura; break;
                case 
10423statusFlag Update.Flags2.FireAura; break;
                case 
10422statusFlag Update.Flags2.WaterAura; break;
                case 
10421statusFlag Update.Flags2.WoodAura; break;
                case 
10420statusFlag Update.Flags2.MetalAura; break;
                case 
10410statusFlag Update.Flags2.FendAura; break;
                case 
10395statusFlag Update.Flags2.TyrantAura; break;
            }
            switch (
spell.ID)
            {
                case 
10424statusFlag2 Update.Flags2.EarthAura2; break;
                case 
10423statusFlag2 Update.Flags2.FireAura2; break;
                case 
10422statusFlag2 Update.Flags2.WaterAura2; break;
                case 
10421statusFlag2 Update.Flags2.WoodAura2; break;
                case 
10420statusFlag2 Update.Flags2.MetalAura2; break;
                case 
10410statusFlag2 Update.Flags2.FendAura2; break;
                case 
10395statusFlag2 Update.Flags2.TyrantAura2; break;
            }

            if (
attacker.Dead) return;
            if (
attacker.Aura_isActive)
            {
                switch (
attacker.Aura_actType)
                {
                    case 
10424aura Update.AuraType.EarthAura; break;
                    case 
10423aura Update.AuraType.FireAura; break;
                    case 
10422aura Update.AuraType.WaterAura; break;
                    case 
10421aura Update.AuraType.WoodAura; break;
                    case 
10420aura Update.AuraType.MetalAura; break;
                    case 
10410aura Update.AuraType.FendAura; break;
                    case 
10395aura Update.AuraType.TyrantAura; break;
                }
                new 
Update(true).Aura(attackerUpdate.AuraDataTypes.Removeauraspell);

                
attacker.RemoveFlag2(attacker.Aura_actType);
                
attacker.RemoveFlag2(attacker.Aura_actType2);
                
//attacker.Owner.removeAuraBonuses(statusFlag, spell.Power, 1);
                
attacker.Owner.removeAuraBonuses(attacker.Aura_actTypeattacker.Aura_actPower1);
                
attacker.Aura_isActive false;
                
attacker.AuraTime 0;
                if (
statusFlag == attacker.Aura_actType)
                {
                    
attacker.Aura_actType 0;
                    
attacker.Aura_actType2 0;
                    
attacker.Aura_actPower 0;
                    
attacker.Aura_actLevel 0;
                    return;
                }



            }
            if (
CanUseSpell(spellattacker.Owner))
            {
                if (
statusFlag != 0)
                {
                    switch (
attacker.Aura_actType)
                    {
                        case 
10424aura Update.AuraType.EarthAura; break;
                        case 
10423aura Update.AuraType.FireAura; break;
                        case 
10422aura Update.AuraType.WaterAura; break;
                        case 
10421aura Update.AuraType.WoodAura; break;
                        case 
10420aura Update.AuraType.MetalAura; break;
                        case 
10410aura Update.AuraType.FendAura; break;
                        case 
10395aura Update.AuraType.TyrantAura; break;
                    }
                    new 
Update(true).Aura(attackerUpdate.AuraDataTypes.Removeauraspell);

                    
attacker.RemoveFlag2(attacker.Aura_actType);
                    
attacker.RemoveFlag2(attacker.Aura_actType2);
                    
attacker.Owner.removeAuraBonuses(attacker.Aura_actTypeattacker.Aura_actPower1);
                    
attacker.Aura_isActive false;
                    
attacker.AuraTime 0;
                    if (
statusFlag == attacker.Aura_actType)
                    {
                        
attacker.Aura_actType2 0;
                        
attacker.Aura_actType 0;
                        
attacker.Aura_actPower 0;
                        
attacker.Aura_actLevel 0;
                    }



                }
                
attacker.AuraStamp Time32.Now;
                if (
spell.Power == 0spell.Power 45;
                
attacker.AuraTime = (short)(spell.Power 20);

                
PrepareSpell(spellattacker.Owner);

                
SpellUse suse = new SpellUse(true);
                
suse.Attacker attacker.UID;
                
suse.SpellID spell.ID;
                
suse.SpellLevel spell.Level;
                
suse.attacker.X;
                
suse.attacker.Y;

                
suse.AddTarget(attacker0null);
                
attacker.Owner.SendScreen(susetrue);
                
attacker.AddFlag2(statusFlag);
                
attacker.AddFlag2(statusFlag2);
                
attacker.Aura_isActive true;
                
attacker.Aura_actType statusFlag;
                
attacker.Aura_actType2 statusFlag2;
                
attacker.Aura_actPower spell.Power;
                
attacker.Aura_actLevel spell.Level;
                
attacker.Owner.doAuraBonuses(statusFlagspell.Power1);

                switch (
spell.ID)
                {
                    case 
10424aura Update.AuraType.EarthAura; break;
                    case 
10423aura Update.AuraType.FireAura; break;
                    case 
10422aura Update.AuraType.WaterAura; break;
                    case 
10421aura Update.AuraType.WoodAura; break;
                    case 
10420aura Update.AuraType.MetalAura; break;
                    case 
10410aura Update.AuraType.FendAura; break;
                    case 
10395aura Update.AuraType.TyrantAura; break;
                }
                new 
Update(true).Aura(attackerUpdate.AuraDataTypes.Addauraspell);

            }

        }
        public static List<
IMapObjectGetObjects(UInt16 oxUInt16 oyClient.GameState c)
        {
            
UInt16 xy;
            
c.Player.X;
            
c.Player.Y;

            var list = new List<
IMapObject>();
            
c.Player.ox;
            
c.Player.oy;
            foreach (
IMapObject objects in c.Screen.Objects)
            {
                if (
objects != null)
                    if (
objects.UID != c.Player.UID)
                        if (!list.
Contains(objects))
                            list.
Add(objects);
            }
            
c.Player.x;
            
c.Player.y;
            foreach (
IMapObject objects in c.Screen.Objects)
            {
                if (
objects != null)
                    if (
objects.UID != c.Player.UID)
                        if (!list.
Contains(objects))
                            list.
Add(objects);
            }
            if (list.
Count 0)
                return list;
            return 
null;
        }

        public static 
void ReceiveAttack(Game.Entity attackerGame.Entity attackedAttack attackref uint damageDatabase.SpellInformation spell)
        {

            if (
attacked == null || attacker == null) { damage 0; return; };
            
bool loadItemStats false;

            
#region WaniacDance
            
if (attacked.ContainsFlag3(Network.GamePackets.Update.Flags3.WaniacDance))
            {
                
damage 0;
            }
            
#endregion
            #region Perfection
            
if (attacker.EntityFlag == EntityFlag.Entity)
            {
                
#region Perfection
                
Game.Enums.PerfectionEffect effect Enums.PerfectionEffect.CalmWind;
                
byte chance 0;
                new 
MsgRefineEffect().GenerateEffectandChance(attacker.Ownerref effectref chance);
                if (
Kernel.Rate(chance))
                {
                    new 
MsgRefineEffect().SendEffect(attackerattackedeffect);
                }
                
#endregion
            
}
            if (
attacker.EntityFlag == EntityFlag.Entity)
            {
                
#region Perfection
                
byte chance 0;
                new 
MsgRefineEffect().HandleLuckyStrike(attackerref chance);
                if (
Kernel.Rate(chance))
                {
                    new 
MsgRefineEffect().SendEffect(attackerattackedGame.Enums.PerfectionEffect.LuckyStrike);
                    
damage *= (uint)(damage 0.298);
                }
                
#endregion
            
}
            if (
attacked.EntityFlag == EntityFlag.Entity)
            {
                
#region Perfection
                
Game.Enums.PerfectionEffect effect Enums.PerfectionEffect.Stricklock;
                
byte chance 0;
                new 
MsgRefineEffect().HandleStrickeLock(attackerref chance);
                if (
Kernel.Rate(chance))
                {
                    new 
MsgRefineEffect().SendEffect(attackedattackereffect);
                    return;
                }
                
#endregion
            
}
            if (
attacked.EntityFlag == EntityFlag.Entity)
            {
                
#region Perfection
                
Game.Enums.PerfectionEffect effect Enums.PerfectionEffect.Stricklock;
                
byte chance 0;
                new 
MsgRefineEffect().HandleBloodSpawn(attackedref chance);
                if (
Kernel.Rate(chance))
                {
                    new 
MsgRefineEffect().SendEffect(attackedattackereffect);
                    
attacked.Hitpoints attacked.MaxHitpoints;
                    
attacked.Mana attacked.MaxMana;
                }
                
#endregion
            
}
            if (
attacked.EntityFlag == EntityFlag.Entity)
            {
                
#region Perfection
                
Game.Enums.PerfectionEffect effect Enums.PerfectionEffect.MirrorofSin;
                
byte chance 0;
                new 
MsgRefineEffect().HandleMirror(attackedref chance);
                if (
Kernel.Rate(chance))
                {
                    new 
MsgRefineEffect().SendEffect(attackedattackereffect);
                    
attacked.AddFlag(Network.GamePackets.Update.Flags.XPList);
                }
                
#endregion
            
}
            
#endregion
            /*#region Perfection
            if (attacker.EntityFlag == EntityFlag.Entity)
            {

                uint rand = (uint)Mr_Panda.Kernel.Random.Next(2, 2);
                switch (rand)
                {
                    case 1:
                        {
                            #region Perfection
                            Game.Enums.PerfectionEffect effect = Enums.PerfectionEffect.CalmWind;
                            byte chance = 0;
                            new MsgRefineEffect().GenerateEffectandChance(attacker.Owner, ref effect, ref chance);
                            if (Kernel.Rate(chance))
                            {
                                new MsgRefineEffect().SendEffect(attacker, attacked, effect);
                            }
                            #endregion
                            break;
                        }
                    case 2:
                        {
                            #region Perfection
                            byte chance = 0;
                            new MsgRefineEffect().HandleLuckyStrike(attacker, ref chance);
                            if (Kernel.Rate(chance))
                            {
                                Network.Writer.WriteUInt16((ushort)(1 << 10), 36, attack.ToArray());
                                new MsgRefineEffect().SendEffect(attacker, attacked, Game.Enums.PerfectionEffect.LuckyStrike);
                                //damage = 200 ,100;
                                damage = (uint)(damage * 200.100);
                            }
                            #endregion
                            break;
                        }

                }

            }
            #endregion*/
            #region Perfection
            
if (attacked.EntityFlag == EntityFlag.Entity)
            {
                
uint rand = (uint)Mr_Panda.Kernel.Random.Next(12);
                switch (
rand)
                {

                    case 
1:
                        {
                            
//if (attacked.PlayerFlag == PlayerFlag.Player)
                            
{
                                
#region Perfection
                                
byte chance 1;
                                new 
MsgRefineEffect().HandleStrickeLock(attackerref chance);
                                if (
Kernel.Rate(chance))
                                {
                                    
Game.Enums.PerfectionEffect effect Enums.PerfectionEffect.Stricklock;
                                    new 
MsgRefineEffect().SendEffect(attackedattackereffect);
                                    return;
                                }
                                
#endregion
                            
}

                            break;
                        }
                    case 
2:
                        {

                            
//if (attacked.PlayerFlag == PlayerFlag.Player)
                            
{
                                
#region Perfection
                                
Game.Enums.PerfectionEffect effect Enums.PerfectionEffect.MirrorofSin;
                                
byte chance 0;
                                new 
MsgRefineEffect().HandleMirror(attackedref chance);
                                if (
Kernel.Rate(chance))
                                {
                                    new 
MsgRefineEffect().SendEffect(attackedattackereffect);
                                    
attacked.AddFlag((ulong)Network.GamePackets.Update.Flags.XPList);
                                    
attacker.Owner.XPListStamp Time32.Now;
                                }
                                
#endregion
                            
}
                            break;
                        }

                }

            }


            
#endregion

            #region ThunderCloud
            
if (attacked.Name == "Thundercloud")
            {
                if (
spell != null && spell.ID != 0)
                {
                    if (
Kernel.Rate(75)) damage 1;
                    else 
damage 0;
                }
                else if (
spell == null || spell.ID == 0)
                {
                    
damage 1;
                }
            }
            foreach (var 
th in Kernel.Maps[attacker.MapID].Entities.Values.Where(=> i.Name == "Thundercloud"))
            {
                if (
th.UID == attacked.UID)
                {
                    if (
attacker == null || Kernel.GetDistance(attacker.Xattacker.Yth.Xth.Y) > th.MonsterInfo.AttackRange || attacker.Dead) break;
                    
th.MonsterInfo.InSight attacker.UID;
                    break;
                }
            }
            
#endregion
            #region RevengeTaill
            
if (attacked.ContainsFlag4(Network.GamePackets.Update.Flags4.RevengeTaill))
            {
                if (
attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(13030))
                {
                    var 
spelll Database.SpellTable.GetSpell(13030attacked.Owner);
                    if (
damage <= spelll.Power)
                    {
                        
SpellUse suses = new SpellUse(true);
                        
suses.Attacker attacked.UID;
                        
suses.Attacker1 attacker.UID;
                        
suses.SpellID 13030;
                        
suses.SpecialEffect 1;
                        
suses.AddTarget(attacker.UIDdamagenull);
                        if (
attacker.Hitpoints <= damage)
                        {
                            
attacker.Die(attacked);
                        }
                        else
                        {
                            
attacker.Hitpoints -= damage;
                        }
                        
attacked.Owner.SendScreen(susestrue);
                    }
                }
            }
            
#endregion
            #region BackFire
            
if (attacked.ContainsFlag3((ulong)Network.GamePackets.Update.Flags3.BackFire))
            {
                if (
attacked.Owner != null && attacked.Owner.Spells != null && attacked.Owner.Spells.ContainsKey(12680))
                {
                    var 
spelll Database.SpellTable.GetSpell(12680attacked.Owner);
                    if (
damage <= spelll.Power)
                    {
                        
SpellUse suses = new SpellUse(true);
                        
suses.Attacker attacked.UID;
                        
suses.Attacker1 attacker.UID;
                        
suses.SpellID 12680;
                        
suses.SpecialEffect 1;
                        
attack.AttackType Attack.BackFire;
                        
suses.AddTarget(attacker.UIDdamagenull);
                        if (
attacker.Hitpoints <= damage)
                        {
                            
attacker.Die(attacked);
                        }
                        else
                        {
                            
attacker.Hitpoints -= damage;
                        }
                        
attacked.Owner.SendScreen(susestrue);
                    }
                }
            }
            
#endregion
            #region ChillingSnow
            
if (attacked.ContainsFlag4(Update.Flags4.ChillingSnow) && attacked.IsStomper2() && attacker.EntityFlag == EntityFlag.Entity)
            {
                var 
spell1 Database.SpellTable.GetSpell(12960attacked.Owner);
                
int rate 95;
                
int diff attacker.BattlePower attacked.BattlePower;
                if (
diff 0diff 0;
                
rate -= (byte)(diff 5);
                if (
rate 0rate 0;
                if (
Kernel.Rate(rate))
                {
                    
attacker.AddFlag4(Update.Flags4.xChillingSnow);
                    
attacker.ChillingSnowStamp Time32.Now;
                    
attacker.ChillingSnow = (byte)(spell1.Level 1);
                }
            }
            
#endregion
            #region FreezingPelter
            
if (attacked.ContainsFlag4(Update.Flags4.FreezingPelter) && attacked.IsStomper2() && attacker.EntityFlag == EntityFlag.Entity)
            {
                var 
spell1 Database.SpellTable.GetSpell(13020attacked.Owner);
                
int rate 30;
                
int diff attacker.BattlePower attacked.BattlePower;
                if (
diff 0diff 0;
                
rate -= (byte)(diff 5);
                if (
rate 0rate 0;
                if (
Kernel.Rate(rate))
                {
                    
attacker.AddFlag4(Update.Flags4.xFreezingPelter);
                    
attacker.FreezingPelterStamp Time32.Now;
                    
byte num 0;
                    if (
spell1.Level == 0num 1;
                    if (
spell1.Level == 1num 1;
                    if (
spell1.Level == 2num 2;
                    if (
spell1.Level == 3num 2;
                    if (
spell1.Level == 4num 3;
                    if (
spell1.Level == 5num 3;
                    if (
spell1.Level == 5num 4;
                    
attacker.FreezingPelter num;
                }
            }
            
#endregion

            
if (!(attacked.Name.Contains("Guard") && attacked.EntityFlag == EntityFlag.Monster))
                if (
attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag != EntityFlag.Entity && !attacked.Name.Contains("Guard"))
                {
                    if (
damage attacked.Hitpoints)
                    {
                        
attacker.Owner.IncreaseExperience(Calculate.CalculateExpBonus(attacker.Levelattacked.LevelMath.Min(damageattacked.Hitpoints)), true);
                        if (
spell != null)
                            
attacker.Owner.IncreaseSpellExperience((uint)Calculate.CalculateExpBonus(attacker.Levelattacked.LevelMath.Min(damageattacked.Hitpoints)), spell.ID);
                    }
                    else
                    {
                        
attacker.Owner.IncreaseExperience(Calculate.CalculateExpBonus(attacker.Levelattacked.Leveldamage), true);
                        if (
spell != null)
                            
attacker.Owner.IncreaseSpellExperience((uint)Calculate.CalculateExpBonus(attacker.Levelattacked.Leveldamage), spell.ID);
                    }
                }
            if (
attacker.EntityFlag == EntityFlag.Monster && attacked.EntityFlag == EntityFlag.Entity)
            {
                if (
attacked.Action == Enums.ConquerAction.Sit)
                    if (
attacked.Stamina 20)
                        
attacked.Stamina -= 1;
                    else
                        
attacked.Stamina 0;
                
attacked.Action Enums.ConquerAction.None;
            }

            if (
attack.AttackType == Attack.Magic)
            {
                if (
attacked.Hitpoints <= damage)
                {
                    
#region SkillSoul Name
                    
if (attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag == EntityFlag.Entity)
                    {
                        if (
attacker.MyJiang != null)
                        {
                            if (
attacker.MyJiang.Inner_Strength >= 48600)
                            {
                                if (
Npcs.SkillSoul_Allowed == null) return;
                                if (
spell == null) return;
                                if (
Npcs.SkillSoul_Allowed.Contains(spell.ID))
                                {
                                    
byte[] tets = new byte[12 8];
                                    
Writer.Ushort(120tets);
                                    
Writer.Ushort(27102tets);
                                    
Writer.Uint(spell.ID4tets);
                                    
attacker.Owner.Send(tets);
                                }
                            }
                        }
                    }
                    
#endregion
                    
if (attacked.Owner != null)
                    {
                        
attacker.Owner.UpdateQualifier(attacker.Ownerattacked.Ownerattacked.Hitpoints);
                    }
                    
attacked.CauseOfDeathIsMagic true;
                    
attacked.Die(attacker);
                    
attacked.IsDropped false;

                    if (
attacker.PKMode == Enums.PKMode.Jiang)
                    {
                        if (
attacked.JiangActive)
                        {
                            if (
attacker.MyJiang != null && attacker.MyJiang != null)
                                
attacker.MyJiang.GetKill(attacker.Ownerattacked.MyJiang);
                        }
                    }
                    if (
attacked.Owner != null && attacker.Owner != null)
                    {
                        if (
attacked.Owner.Team != null && attacker.Owner.Team != null)
                        {
                            if (
attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
                            {
                                if (
attacker.Owner.Team.EliteMatch != null)
                                {
                                    if (!
attacked.Owner.Team.Alive)
                                    {
                                        
attacker.Owner.Team.EliteFighterStats.Points += damage;
                                        
attacker.Owner.Team.EliteMatch.End(attacked.Owner.Team);
                                    }
                                    else
                                    {
                                        
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
                                        
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
                                    }
                                }
                            }
                        }
                    }
                }
                else
                {
                    if (
attacked.Owner != null && attacker.Owner != null)
                    {
                        if (
attacked.Owner.Team != null && attacker.Owner.Team != null)
                        {
                            if (
attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
                            {
                                if (
attacker.Owner.Team.EliteMatch != null)
                                {
                                    
//if (attacker.MapID == attacked.Owner.Team.EliteMatch.Map.ID
                                    
attacker.Owner.Team.EliteFighterStats.Points += damage;
                                    
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
                                    
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
                                }
                            }
                        }
                    }
                    if (
attacked.Owner != null)
                    {
                        
attacker.Owner.UpdateQualifier(attacker.Ownerattacked.Ownerdamage);
                    }

                    
attacked.Hitpoints -= damage;
                }
            }
            else
            {
                if (
attacked.Hitpoints <= damage)
                {
                    if (
attacked.EntityFlag == EntityFlag.Entity)
                    {

                        
attacker.Owner.UpdateQualifier(attacker.Ownerattacked.Ownerattacked.Hitpoints);
                        
attacked.Owner.SendScreen(attacktrue);
                        
attacker.AttackPacket null;
                    }
                    else
                    {
                        
attacked.MonsterInfo.SendScreen(attack);
                    }
                    
attacked.Die(attacker);
                    if (
attacker.PKMode == Enums.PKMode.Jiang)
                    {
                        if (
attacked.JiangActive)
                        {
                            if (
attacker.MyJiang != null && attacker.MyJiang != null)
                                
attacker.MyJiang.GetKill(attacker.Ownerattacked.MyJiang);
                        }
                    }
                    if (
attacked.Owner != null && attacker.Owner != null)
                    {
                        if (
attacked.Owner.Team != null && attacker.Owner.Team != null)
                        {
                            if (
attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
                            {
                                if (
attacker.Owner.Team.EliteMatch != null)
                                {
                                    if (
attacker.MapID == attacked.Owner.Team.EliteMatch.Map.ID)
                                    {
                                        if (!
attacked.Owner.Team.Alive)
                                        {
                                            
attacker.Owner.Team.EliteFighterStats.Points += damage;
                                            
attacker.Owner.Team.EliteMatch.End(attacked.Owner.Team);
                                        }
                                        else
                                        {
                                            
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
                                            
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
                                        }
                                    }
                                }
                            }
                        }
                    }

                }
                else
                {
                    if (
attacked.Owner != null && attacker.Owner != null)
                    {
                        if (
attacked.Owner.Team != null && attacker.Owner.Team != null)
                        {
                            if (
attacker.Owner.Team.EliteFighterStats != null && attacked.Owner.Team.EliteFighterStats != null)
                            {
                                if (
attacker.Owner.Team.EliteMatch != null)
                                {
                                    if (
attacker.MapID == attacked.Owner.Team.EliteMatch.Map.ID)
                                    {
                                        
attacker.Owner.Team.EliteFighterStats.Points += damage;
                                        
attacker.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
                                        
attacked.Owner.Team.SendMesageTeam(attacker.Owner.Team.EliteMatch.CreateUpdate().ToArray(), 0);
                                    }
                                }
                            }
                        }
                    }
                    
attacked.Hitpoints -= damage;
                    if (
attacked.EntityFlag == EntityFlag.Entity)
                    {
                        
attacker.Owner.UpdateQualifier(attacker.Ownerattacked.Ownerdamage);
                        
attacked.Owner.SendScreen(attacktrue);
                    }
                    else
                        
attacked.MonsterInfo.SendScreen(attack);
                    
attacker.AttackPacket attack;
                    
attacker.AttackStamp Time32.Now;
                }
            }

            
#region Process Perfection Attributes After Attack Successed
            
if (attacked.EntityFlag == EntityFlag.Entity && loadItemStats)
            {
                
attacked.Owner.LoadItemStats();
            }
            
#endregion
            #region ThunderCloud
            
foreach (var th in Kernel.Maps[attacker.MapID].Entities.Values.Where(=> i.Name == "Thundercloud"))
            {
                if (
th.OwnerUID == attacker.UID)
                {
                    if (
attacked == null || Kernel.GetDistance(attacked.Xattacked.Yth.Xth.Y) > th.MonsterInfo.AttackRange || attacked.Dead) break;
                    
th.MonsterInfo.InSight attacked.UID;
                    break;
                }
            }
            
#endregion
            
if (attacked.MonsterInfo != null)
            {
                
Update up = new Update(true);
                
up.UID attacked.UID;
                
up.Append(Update.MaxHitpointsattacked.MaxHitpoints);
                
up.Append(Update.Hitpointsattacked.Hitpoints);
                
attacked.MonsterInfo.SendScreen(up);
            }
        }
        public static 
void ReceiveAttack(Game.Entity attackerSobNpcSpawn attackedAttack attackuint damageDatabase.SpellInformation spell)
        {
            
#region Union War
            
if (attacker.EntityFlag == EntityFlag.Entity)
            {
                if (
attacked.UID == 817)
                {
                    
Mr_Panda.Network.GamePackets.Union.UnionClass Union;
                    if (
attacker.Owner.Union != null && attacker.Owner.UnionID != 0)
                    {
                        if (
Kernel.Unions.TryGetValue(attacker.Owner.UnionIDout Union))
                        {
                            if (
attacked.Hitpoints <= damage)
                                
attacked.Hitpoints 0;
                            
Game.UnionWar.AddScore(damageUnion);
                        }
                    }
                }
            }
            
#endregion
            
if (attacker.EntityFlag == EntityFlag.Entity)
                if (
damage attacked.Hitpoints)
                {
                    if (
attacker.MapID == 1039)
                        
attacker.Owner.IncreaseExperience(Math.Min(damageattacked.Hitpoints), true);
                    if (
spell != null)
                        
attacker.Owner.IncreaseSpellExperience(Math.Min(damageattacked.Hitpoints), spell.ID);
                }
                else
                {
                    if (
attacker.MapID == 1039)
                        
attacker.Owner.IncreaseExperience(damagetrue);
                    if (
spell != null)
                        
attacker.Owner.IncreaseSpellExperience(damagespell.ID);
                }
            if (
attacked.UID == 123456)
            {
            }

            if (
attacker.MapID == CaptureTheFlag.MapID)
                if (
attacker.GuildID != && Program.World.CTF.Bases[attacked.UID].CapturerID != attacker.GuildID)
                {
                    
Program.World.CTF.AddScore(damageattacker.Owner.Guildattacked);
                }
            
#region StatuesWar
            
if (Game.StatuesWar.IsWar)
            {
                if (
attacker.MapID == Game.StatuesWar.Map.ID)
                {
                    if (
attacked.UID == Game.StatuesWar.Pole.UID)
                    {
                        if (
Game.StatuesWar.PoleKeeper == attacker.Owner.AsMember)
                            return;
                        if (
attacked.Hitpoints <= damage)
                            
attacked.Hitpoints 0;
                        
Game.StatuesWar.AddScore(damageattacker.Owner.AsMember);
                    }
                }
            }
            
#endregion TWin War
            #region Clan War

            
if (attacker.MapID == 1509)
            {
                if (
attacked.UID == 812)
                {
                    
Clan clan attacker.GetClan;
                    if (
Game.ClanWar.PoleKeeper == clan)
                        return;
                    if (
attacked.Hitpoints <= damage)
                        
attacked.Hitpoints 0;
                    
Game.ClanWar.AddScore(damageclan);
                }
            }
            
#endregion

            #region Satke Cps 10 by ahmed
            #region  Satke Cps
            
if (attacker.MapID == 1039)
            {
                if (
attacked.UID == 6462)
                {
                    
attacked.Die(attacker);
                    {
                        if (
attacker.VIPLevel <= 6)
                        {
                            
attacker.ConquerPoints += 10;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip [DevilPower]MR-Mahmuod" attacker.VIPLevel " lw m3ak vip 50 hygylk 7 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                        else
                        {
                            
attacker.ConquerPoints += 50;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip [DevilPower]MR-Mahmoud" attacker.VIPLevel " hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                    }
                }
            }
            
#endregion
            #region  Satke Cps
            
if (attacker.MapID == 1039)
            {
                if (
attacked.UID == 6463)
                {
                    
attacked.Die(attacker);
                    {
                        if (
attacker.VIPLevel <= 6)
                        {
                            
attacker.ConquerPoints += 10;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" attacker.VIPLevel " lw m3ak vip 7 hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                        else
                        {
                            
attacker.ConquerPoints += 50;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" attacker.VIPLevel " hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                    }
                }
            }
            
#endregion
            #region  Satke Cps
            
if (attacker.MapID == 1039)
            {
                if (
attacked.UID == 6464)
                {
                    
attacked.Die(attacker);
                    {
                        if (
attacker.VIPLevel <= 6)
                        {
                            
attacker.ConquerPoints += 10;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" attacker.VIPLevel " lw m3ak vip 7 hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                        else
                        {
                            
attacker.ConquerPoints += 50;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" attacker.VIPLevel " hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                    }
                }
            }
            
#endregion
            #region  Satke Cps
            
if (attacker.MapID == 1039)
            {
                if (
attacked.UID == 6465)
                {
                    
attacked.Die(attacker);
                    {
                        if (
attacker.VIPLevel <= 6)
                        {
                            
attacker.ConquerPoints += 10;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" attacker.VIPLevel " lw m3ak vip 7 hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                        else
                        {
                            
attacker.ConquerPoints += 50;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" attacker.VIPLevel " hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                    }
                }
            }
            
#endregion
            #region  Satke Cps
            
if (attacker.MapID == 1039)
            {
                if (
attacked.UID == 6005)
                {
                    
attacked.Die(attacker);
                    {
                        if (
attacker.VIPLevel <= 6)
                        {
                            
attacker.ConquerPoints += 10;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" attacker.VIPLevel " lw m3ak vip 7 hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                        else
                        {
                            
attacker.ConquerPoints += 50;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" attacker.VIPLevel " hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                    }
                }
            }
            
#endregion
            #region  Satke Cps
            
if (attacker.MapID == 1039)
            {
                if (
attacked.UID == 6006)
                {
                    
attacked.Die(attacker);
                    {
                        if (
attacker.VIPLevel <= 6)
                        {
                            
attacker.ConquerPoints += 10;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" attacker.VIPLevel " lw m3ak vip 7 hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                        else
                        {
                            
attacker.ConquerPoints += 50;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" attacker.VIPLevel " hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                    }
                }
            }
            
#endregion
            #region  Satke Cps
            
if (attacker.MapID == 1039)
            {
                if (
attacked.UID == 6014)
                {
                    
attacked.Die(attacker);
                    {
                        if (
attacker.VIPLevel <= 6)
                        {
                            
attacker.ConquerPoints += 10;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" attacker.VIPLevel " lw m3ak vip 7 hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                        else
                        {
                            
attacker.ConquerPoints += 50;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" attacker.VIPLevel " hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                    }
                }
            }
            
#endregion
            #region  Satke Cps
            
if (attacker.MapID == 1002)
            {
                if (
attacked.UID == 6025)
                {
                    
attacked.Die(attacker);
                    {
                        if (
attacker.VIPLevel <= 6)
                        {
                            
attacker.ConquerPoints += 10;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 5dt 10 cps 34an anth m3ak vip" attacker.VIPLevel " lw m3ak vip 7 hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                        else
                        {
                            
attacker.ConquerPoints += 50;
                            
attacker.Owner.Send(new Message("Lkd ktlt 3sayh mskinh o 34an anth vip" attacker.VIPLevel " hygylk 50 cps #00"System.Drawing.Color.AzureMessage.TopLeft));
                        }
                    }
                }
            }
            
#endregion
            #endregion
            
if (Game.NobiltyPoleWar.IsWar)
            {
                if (
attacker.MapID == NobiltyPoleWar.Map.ID)
                {
                    
NobiltyPoleWar.Attack(damageattackerattacked);
                }
            }

            if (
attacker.MapID == 1038)
            {
                if (
attacked.UID == 810)
                {
                    if (
Game.GuildWar.PoleKeeper == attacker.Owner.Guild)
                        return;
                    if (
attacked.Hitpoints <= damage)
                        
attacked.Hitpoints 0;
                    
Game.GuildWar.AddScore(damageattacker.Owner.Guild);
                }
            }
            if (
attacker.MapID == 10380)
            {
                if (
attacked.UID == 8100)
                {
                    if (
Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
                        return;
                    if (
attacked.Hitpoints <= damage)
                        
attacked.Hitpoints 0;
                    
Game.SuperGuildWar.AddScore(damageattacker.Owner.Guild);
                }
            }
            if (
attacker.MapID == 2071)
            {
                if (
attacked.UID == 811)
                {
                    if (
Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
                        return;
                    if (
attacked.Hitpoints <= damage)
                        
attacked.Hitpoints 0;
                    
Game.EliteGuildWar.AddScore(damageattacker.Owner.Guild);
                }
                if (
Game.EliteGuildWar.Poles != null && Game.EliteGuildWar.Poles != null)
                {
                    if (
attacked.UID == Game.EliteGuildWar.Poles.UID)
                    {
                        if (
Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
                            return;
                        if (
attacked.Hitpoints <= damage)
                            
attacked.Hitpoints 0;
                        
Game.EliteGuildWar.AddScore(damageattacker.Owner.Guild);
                    }
                    if (
attacked.UID == Game.EliteGuildWar.Poles.UID)
                    {
                        if (
Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
                            return;
                        if (
attacked.Hitpoints <= damage)
                            
attacked.Hitpoints 0;
                        
Game.EliteGuildWar.AddScore(damageattacker.Owner.Guild);
                    }
                }
            }
            if (
attack.AttackType == Attack.Magic)
            {
                if (
attacked.Hitpoints <= damage)
                {
                    
attacked.Die(attacker);
                }
                else
                {
                    
attacked.Hitpoints -= damage;
                    if (
attacker.Owner != null)
                    {
                        if (
attacker.Owner.Map.Statues.ContainsKey(attacked.UID))
                        {
                            
// attacker.Owner.Send(attacked.SpawnPacket);
                            
attacked.SendSpawn(attacker.Owner);
                        }
                    }
                }
            }
            else
            {
                
attacker.Owner.SendScreen(attacktrue);
                if (
attacked.Hitpoints <= damage)
                {
                    
attacked.Die(attacker);
                }
                else
                {
                    
attacked.Hitpoints -= damage;
                    if (
attacker.Owner != null)
                    {
                        if (
attacker.Owner.Map.Statues.ContainsKey(attacked.UID))
                        {
                            
// attacker.Owner.Send(attacked.SpawnPacket);
                            
attacked.SendSpawn(attacker.Owner);
                        }
                    }
                    
attacker.AttackPacket attack;
                    
attacker.AttackStamp Time32.Now;
                }
            }
        }
        public static 
bool isArcherSkill(uint ID)
        {
            if (
ID >= 8000 && ID <= 9875)
                return 
true;
            return 
false;
        }
        public static 
bool CanUseSpell(Database.SpellInformation spellClient.GameState client)
        {
            if (
client.Player.SkillTeamWatchingElitePKMatch != null)
                return 
false;
            if (
client.WatchingElitePKMatch != null)
                return 
false;
            if (
client.WatchingGroup != null)
                return 
false;
            if (
spell == null)
                return 
false;
            if (
client.Player.Mana spell.UseMana)
                return 
false;
            if (
client.Player.Stamina spell.UseStamina)
                return 
false;
            if (
spell.UseArrows && isArcherSkill(spell.ID))
            {
                var 
weapons client.Weapons;
                if (
weapons.Item2 != null)
                    if (!
client.Player.ContainsFlag3(Update.Flags3.Assassin))
                        if (!
PacketHandler.IsArrow(weapons.Item2.ID))
                            return 
false;

                return 
true;
            }
            if (
spell.NeedXP == && !client.Player.ContainsFlag(Update.Flags.XPList))
                return 
false;
            return 
true;
        }
        public static 
void PrepareSpell(Database.SpellInformation spellClient.GameState client)
        {
            if (
spell.NeedXP == 1)
                
client.Player.RemoveFlag(Update.Flags.XPList);
            if (
client.Map.ID != 1039)
            {
                if (
spell.UseMana 0)
                    if (
client.Player.Mana >= spell.UseMana)
                        
client.Player.Mana -= spell.UseMana;
                if (
spell.UseStamina 0)
                    if (
client.Player.Stamina >= spell.UseStamina)
                        
client.Player.Stamina -= spell.UseStamina;
            }
        }
        public static 
bool CanAttack(Game.Entity attackerSobNpcSpawn attackedDatabase.SpellInformation spell)
        {

            if (
attacked == null)
                return 
false;
            if (
attacked.UID == 817 && attacker.Owner.Union != null)
            {
                if (
attacked.Name == attacker.Owner.Union.Name)
                    return 
false;
                else
                    return 
true;
            }
            if (
Database.GuildCondutors.GuildConductors != null)
                if (
Database.GuildCondutors.GuildConductors.ContainsKey(attacked.UID))
                    return 
false;
            if (
attacker.MapID == CaptureTheFlag.MapID)
            {
                if (
Program.World.CTF.Bases.ContainsKey(attacked.UID))
                {
                    var 
_base Program.World.CTF.Bases[attacked.UID];
                    if (
_base.CapturerID == attacker.GuildID)
                        return 
false;
                }
                return 
true;
            }
            if (
attacked.UID == 123456)
                if (
attacked.Hitpoints 0)
                    return 
true;
                else return 
false;

            
#region StatueWar
            
if (Game.StatuesWar.IsWar)
            {
                if (
attacker.MapID == Game.StatuesWar.Map.ID)
                {
                    if (
attacker.GuildID == || !Game.StatuesWar.IsWar)
                        if (
attacked.UID == Game.StatuesWar.Pole.UID)
                            return 
false;
                    if (
Game.StatuesWar.PoleKeeper != null)
                    {
                        if (
Game.StatuesWar.PoleKeeper == attacker.Owner.AsMember)
                            if (
attacked.UID == Game.StatuesWar.Pole.UID)
                                return 
false;
                        if (
Game.StatuesWar.PoleKeeper == attacker.Owner.AsMember)
                            if (
attacker.PKMode == Enums.PKMode.Team)
                                return 
false;

                    }
                }
            }
            
#endregion Twinwar
            #region Clan War
            
if (attacker.MapID == 1509)
            {
                if (
attacker.ClanId == || !Game.ClanWar.IsWar)
                {
                    if (
attacked.UID == 812)
                    {
                        return 
false;
                    }
                }
                if (
Game.ClanWar.PoleKeeper != null)
                {
                    if (
Game.ClanWar.PoleKeeper == attacker.GetClan)
                    {
                        if (
attacked.UID == 812)
                        {
                            return 
false;
                        }
                    }
                }
            }
            
#endregion
            
if (NobiltyPoleWar.IsWar)
            {
                if (
attacker.MapID == NobiltyPoleWar.Map.ID)
                {
                    return 
NobiltyPoleWar.Attack(0attackerattacked);
                }
            }

            if (
attacker.MapID == 1038)
            {
                if (
attacker.GuildID == || !Game.GuildWar.IsWar)
                {
                    if (
attacked.UID == 810)
                    {
                        return 
false;
                    }
                }
                if (
Game.GuildWar.PoleKeeper != null)
                {
                    if (
Game.GuildWar.PoleKeeper == attacker.Owner.Guild)
                    {
                        if (
attacked.UID == 810)
                        {
                            return 
false;
                        }
                    }
                    else if (
attacked.UID == 516075 || attacked.UID == 516074)
                    {
                        if (
Game.GuildWar.PoleKeeper == attacker.Owner.Guild)
                        {
                            if (
attacker.PKMode == Enums.PKMode.Team)
                                return 
false;
                        }
                    }
                }
            }

            if (
attacker.MapID == 10380)
            {
                if (
attacker.GuildID == || !Game.SuperGuildWar.IsWar)
                {
                    if (
attacked.UID == 8100)
                    {
                        return 
false;
                    }
                }
                if (
Game.SuperGuildWar.PoleKeeper != null)
                {
                    if (
Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
                    {
                        if (
attacked.UID == 8100)
                        {
                            return 
false;
                        }
                    }
                    else if (
attacked.UID == 516175 || attacked.UID == 516174)
                    {
                        if (
Game.SuperGuildWar.PoleKeeper == attacker.Owner.Guild)
                        {
                            if (
attacker.PKMode == Enums.PKMode.Team)
                                return 
false;
                        }
                    }
                }
            }
            if (
attacker.MapID == 2071)
            {
                if (
attacker.GuildID == || !Game.EliteGuildWar.IsWar)
                {

                    if (
Game.EliteGuildWar.Poles != null && Game.EliteGuildWar.Poles != null && Game.EliteGuildWar.Poles != null)
                        if (
attacked.UID == Game.EliteGuildWar.Poles.UID || attacked.UID == Game.EliteGuildWar.Poles.UID || attacked.UID == Game.EliteGuildWar.Poles.UID)
                            return 
false;
                }
                if (
Game.EliteGuildWar.PoleKeeper != null)
                {
                    if (
Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
                    {
                        if (
attacked.UID == 811)
                        {
                            return 
false;
                        }

                    }
                }
                if (
Game.EliteGuildWar.PoleKeeper != null)
                {
                    if (
Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
                    {
                        if (
Game.EliteGuildWar.Poles != null)
                            if (
attacked.UID == Game.EliteGuildWar.Poles.UID)
                                return 
false;
                    }
                }
                if (
Game.EliteGuildWar.PoleKeeper != null)
                {
                    if (
Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
                    {
                        if (
Game.EliteGuildWar.Poles != null)
                            if (
attacked.UID == Game.EliteGuildWar.Poles.UID)
                                return 
false;
                    }
                }
                if (
attacked.UID == 516075 || attacked.UID == 516074)
                {
                    if (
Game.EliteGuildWar.PoleKeeper == attacker.Owner.Guild)
                    {
                        if (
attacker.PKMode == Enums.PKMode.Team)
                            return 
false;
                    }
                }

            }
            if (
attacker.MapID == 1039)
            {
                
bool stake true;
                if (
attacked.LoweredName.Contains("crow"))
                    
stake false;

                
ushort levelbase = (ushort)(attacked.Mesh 10);
                if (
stake)
                    
levelbase -= 42;
                else
                    
levelbase -= 43;

                
byte level = (byte)(20 + (levelbase 3) * 5);
                if (
levelbase == 108 || levelbase == 109)
                    
level 125;
                if (
attacker.Level >= level)
                    return 
true;
                else
                {
                    
attacker.AttackPacket null;
                    
attacker.Owner.Send(Constants.DummyLevelTooHigh());
                    return 
false;
                }
            }
            return 
true;
        }
        public static 
void cheakteam(Client.GameState clientNpcs dail)
        {
            if (
client.Team == null)
                
client.Player.Teleport(1002300278);
            
client.Player.AddTopStatus(Update.Flags2.Top3Water2DateTime.Now.AddMinutes(58));
            
uint TeamCount 0;
            foreach (
Client.GameState clients in Program.Values)
            {
                if (
clients.Player.MapID == 16414)
                {
                    if (
clients.Team != null)
                    {
                        if (!
clients.Player.Dead)
                            
TeamCount++;
                    }
                }
            }

            if (
TeamCount <= 5)
            {
                
uint lastcheak 0;
                if (
client.Team != null)
                {
                    foreach (
Client.GameState team in client.Team.Teammates)
                    {
                        if (
team.Player.MapID == 16414 && !team.Player.Dead)
                            
lastcheak++;
                    }
                    if (
TeamCount == lastcheak)
                    {
                        
uint won = (uint)(10000000 client.Team.Teammates.Count());
                        foreach (
Client.GameState team in client.Team.Teammates)
                        {
                            
team.Player.Teleport(1002300278);
                            
client.Player.ConquerPoints += 430;
                            
client.Player.Update(_String.Effect"moonpk_second"true);
                            
client.Player.InnerPower.Potency += 15;
                            foreach (var 
clients in Program.Values)
                            {
                                if (
clients.Player.MapID == 16414)
                                {
                                    
clients.Player.Teleport(1002300278);
                                    
clients.Send(new NpcReply(NpcReply.MessageBox"Sorry Entity Good Luck Next Time ;) "));
                                }
                            }
                        }
                        
Kernel.SendWorldMessage(new Message("Congratulations! " client.Player.Name " Team Has Won Last Team Standing and all Team Member Got 430  ConquerPoint And 15 Points For (InnerPower)"System.Drawing.Color.Red2011), Program.Values);
                    }
                    else
                    {
                        
dail.Text("There Are:| " + (TeamCount lastcheak) + " |: other Entity in other Team Kill Him");
                        
dail.Option("i Will Kill him "255);
                        
dail.Send();
                    }
                }
            }
            else
            {
                
dail.Text("There Are:| " TeamCount " |: other Entity in other Team Kill Him");
                
dail.Option("i Will Kill him "255);
                
dail.Send();
            }

        }
        public static 
bool CanAttack(Game.Entity attackerGame.Entity attackedDatabase.SpellInformation spellbool melee)
        {
            if (
DateTime.Now attacker.Owner.timerattack.AddSeconds(6))
                return 
false;
            if (
attacked.EntityFlag == EntityFlag.Monster)
            {
                if (
attacked.Companion)
                {
                    if (
attacked.Owner == attacker.Owner)
                        return 
false;
                }
            }
            
#region ThunderCloud
            
if (attacked.Name == "Thundercloud")
            {
                if (
attacked.OwnerUID == attacker.UID) return false;
                if (!
Constants.PKForbiddenMaps.Contains(attacker.MapID))
                {
                    if (
attacker.PKMode != Game.Enums.PKMode.PK &&
                     
attacker.PKMode != Game.Enums.PKMode.Team)
                        return 
false;
                    else
                    {
                        
attacker.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
                        
attacker.FlashingNameStamp Time32.Now;
                        
attacker.FlashingNameTime 20;

                        return 
true;
                    }
                }
                else return 
false;
            }
            
#endregion
            
if (attacker.ContainsFlag4(Update.Flags4.xChillingSnow))
                return 
false;
            if (
attacker.MapID == 1507)
            {
                if (!
Game.ClanWarArena.Tournaments[4].Open)
                {
                    if (!
attacker.AllowToAttack)
                        return 
false;
                }
            }
            if (
attacker.EntityFlag == EntityFlag.Entity)
            {
                if (
attacker.Owner.Map.BaseID == (ushort)ElitePKTournament.WaitingAreaID)
                {
                    if (
attacker.Owner.Team != null)
                        if (
attacker.Owner.Team.EliteFighterStats != null)
                            return 
false;
                    if (
attacker.Owner.ElitePKStats != null)
                        return 
false;
                }
            }

            
//if (attacker.MapID == CrossServer.mapid)
            //{
            //    if (attacker.Owner.Country == attacked.Owner.Country)
            //    {
            //        return false;
            //    }
            //}
            //if (attacker.MapID == Hunt_Thief.MAPID)
            //{
            //    if (Hunt_Thief.Hunters.ContainsKey(attacked.UID) && Hunt_Thief.Hunters.ContainsKey(attacker.UID))
            //        return false;
            //    if (Hunt_Thief.Thiefs.ContainsKey(attacked.UID) && Hunt_Thief.Thiefs.ContainsKey(attacker.UID))
            //        return false;
            //    return true;
            //}

            
if (attacker.timerInportChampion.AddSeconds(10) > DateTime.Now)
                return 
false;
            if (
attacker.UID == attacked.UID)
                return 
false;
            if (
attacker.SkillTeamWatchingElitePKMatch != null)
                return 
false;
            if (
attacked.SkillTeamWatchingElitePKMatch != null)
                return 
false;
            if (
spell != null)
            {
//Ahmed Samak : fixing the scatter on fly issue ..  the condition below to constraint the cecking for the attacked is on ground or not on any spell except the scatter.
                
if (spell.ID != 8001)
                {
                    if (
spell.OnlyGround)
                        if (
attacked.ContainsFlag(Update.Flags.Fly))
                            return 
false;
                    if (
melee && attacked.ContainsFlag(Update.Flags.Fly))
                        return 
false;
                }
            }
            if (
spell != null)
            {
                if (
spell.ID == 6010)
                {
                    if (
attacked.ContainsFlag(Update.Flags.Fly))
                        return 
false;
                }
            }
            if (
spell != null)
            {
                if (
spell.ID == 10381)
                {
                    if (
attacked.ContainsFlag(Update.Flags.Fly))
                        return 
false;
                }
            }
            if (
spell != null)
            {
                if (
spell.ID == 6000)
                {
                    if (
attacked.ContainsFlag(Update.Flags.Fly))
                        return 
false;
                }
            }
            if (
spell != null)
            {
                if (
spell.ID == 5030)
                {
                    if (
attacked.ContainsFlag(Update.Flags.Fly))
                        return 
false;
                }
            }
            if (
spell == null)
            {
                if (
attacked.ContainsFlag(Update.Flags.Fly))
                    return 
false;
            }
            if (
attacker.PKMode == Enums.PKMode.Jiang)
            {
                if (
attacked.JiangActive)
                {
                    if (!
attacked.Owner.Attackable)
                        return 
false;
                    if (
attacked.Dead)
                        return 
false;
                    if (
attacker.MapID == 1002 || attacker.MapID == 1000
                        
|| attacker.MapID == 1015 || attacker.MapID == 1020
                        
|| attacker.MapID == 1011)
                        if (
attacked.EntityFlag == EntityFlag.Entity)
                            if (!
attacked.Owner.Attackable)
                                return 
false;
                    {
                        try
                        {
                            if (
attacker.AttackJiang != JiangHu.AttackFlag.None)
                            {
                                if ((
attacker.AttackJiang JiangHu.AttackFlag.NotHitFriends) == JiangHu.AttackFlag.NotHitFriends)
                                {
                                    if (
attacker.Owner.Friends.ContainsKey(attacked.UID))
                                        return 
false;
                                }
                                if ((
attacker.AttackJiang JiangHu.AttackFlag.NoHitAlliesClan) == JiangHu.AttackFlag.NoHitAlliesClan)
                                {
                                    var 
attacker_clan attacker.GetClan;
                                    if (
attacker_clan != null)
                                    {
                                        if (
attacker_clan.Allies.ContainsKey(attacked.ClanId))
                                            return 
false;
                                    }
                                }
                                if ((
attacker.AttackJiang JiangHu.AttackFlag.NotHitAlliedGuild) == JiangHu.AttackFlag.NotHitAlliedGuild)
                                {
                                    if (
attacker.Owner.Guild != null)
                                    {
                                        if (
attacker.Owner.Guild.Ally.ContainsKey(attacked.GuildID))
                                            return 
false;
                                    }
                                }
                                if ((
attacker.AttackJiang JiangHu.AttackFlag.NotHitClanMembers) == JiangHu.AttackFlag.NotHitClanMembers)
                                {
                                    if (
attacker.ClanId == attacked.ClanId)
                                        return 
false;

                                }
                                if ((
attacker.AttackJiang JiangHu.AttackFlag.NotHitGuildMembers) == JiangHu.AttackFlag.NotHitGuildMembers)
                                {
                                    if (
attacker.GuildID == attacked.GuildID)
                                        return 
false;

                                }
                            }
                        }
                        catch (
Exception e) { Console.WriteLine(e.ToString()); }
                        return 
true;
                    }
                    
//  return false;
                
}
            }
            if (
attacked.EntityFlag == EntityFlag.Monster)
                if (
attacked.MonsterInfo.ID == MonsterInformation.ReviverID)
                    return 
false;
            if (
attacked.Dead) return false;
            if (
attacker.EntityFlag == EntityFlag.Entity)
                if (
attacker.Owner.WatchingElitePKMatch != null)
                    return 
false;
            if (
attacked.EntityFlag == EntityFlag.Entity)
                if (
attacked.Owner.WatchingElitePKMatch != null)
                    return 
false;
            if (
attacker.EntityFlag == EntityFlag.Entity)
                if (
attacked != null && attacked.EntityFlag == EntityFlag.Entity)
                    if (
attacker.Owner.InTeamQualifier() && attacked.Owner.InTeamQualifier())
                        return !
attacker.Owner.Team.IsTeammate(attacked.UID);

            if (
attacker.MapID == CaptureTheFlag.MapID)
                if (!
CaptureTheFlag.Attackable(attacker) || !CaptureTheFlag.Attackable(attacked))
                    return 
false;

            if (
spell != null)
                if (
spell.CanKill && attacker.EntityFlag == EntityFlag.Entity && Constants.PKForbiddenMaps.Contains(attacker.Owner.Map.ID) && attacked.EntityFlag == EntityFlag.Entity)
                    return 
false;
            if (
attacker.EntityFlag == EntityFlag.Entity)
                if (
attacker.Owner.WatchingGroup != null)
                    return 
false;
            if (
attacked == null)
                return 
false;
            if (
attacked.Dead)
            {
                
attacker.AttackPacket null;
                return 
false;
            }
            if (
attacker.EntityFlag == EntityFlag.Entity && attacked.EntityFlag == EntityFlag.Entity)
                if ((
attacker.Owner.InQualifier() && attacked.Owner.IsWatching()) || (attacked.Owner.InQualifier() && attacker.Owner.IsWatching()))
                    return 
false;
            if (
attacker.EntityFlag == EntityFlag.Entity)
                if (
Time32.Now attacker.Owner.CantAttack)
                    return 
false;
            if (
attacked.EntityFlag == EntityFlag.Monster)
            {
                if (
attacked.Companion)
                {
                    if (
Constants.PKForbiddenMaps.Contains(attacker.Owner.Map.ID))
                    {
                        if (
attacked.Owner == attacker.Owner)
                            return 
false;
                        if (
attacker.PKMode != Mr_Panda.Game.Enums.PKMode.PK &&
                         
attacker.PKMode != Mr_Panda.Game.Enums.PKMode.Team)
                            return 
false;
                        else
                        {
                            
attacker.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
                            
attacker.FlashingNameStamp Time32.Now;
                            
attacker.FlashingNameTime 10;

                            return 
true;
                        }
                    }
                }
                if (
attacked.Name.Contains("Guard"))
                {
                    if (
attacker.PKMode != Mr_Panda.Game.Enums.PKMode.PK &&
                    
attacker.PKMode != Mr_Panda.Game.Enums.PKMode.Team)
                        return 
false;
                    else
                    {
                        
attacker.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
                        
attacker.FlashingNameStamp Time32.Now;
                        
attacker.FlashingNameTime 10;

                        return 
true;
                    }
                }
                else
                    return 
true;
            }
            else
            {
                if (
attacked.EntityFlag == EntityFlag.Entity)
                    if (!
attacked.Owner.Attackable)
                        return 
false;
                if (
attacker.EntityFlag == EntityFlag.Entity)
                    if (
attacker.Owner.WatchingGroup == null)
                        if (
attacked.EntityFlag == EntityFlag.Entity)
                            if (
attacked.Owner.WatchingGroup != null)
                                return 
false;


                if (
Constants.PKForbiddenMaps.Contains(attacker.Owner.Map.ID))
                {
                    if (
attacker.PKMode == Mr_Panda.Game.Enums.PKMode.PK ||
                        
attacker.PKMode == Mr_Panda.Game.Enums.PKMode.Team || (spell != null && spell.CanKill))
                    {
                        
attacker.Owner.Send(Constants.PKForbidden);
                        
attacker.AttackPacket null;
                    }
                    return 
false;
                }
                if (
attacker.PKMode == Mr_Panda.Game.Enums.PKMode.Capture)
                {
                    if (
attacked.ContainsFlag(Update.Flags.FlashingName) || attacked.PKPoints 99)
                    {
                        return 
true;
                    }
                }
                if (
attacker.PKMode == Mr_Panda.Game.Enums.PKMode.Peace)
                {
                    return 
false;
                }


                if (
attacker.UID == attacked.UID)
                    return 
false;

                if (
attacker.PKMode == Mr_Panda.Game.Enums.PKMode.Team)
                {
                    if (
attacker.Owner.Team != null)
                    {
                        if (
attacker.Owner.Team.IsTeammate(attacked.UID))
                        {
                            
attacker.AttackPacket null;
                            return 
false;
                        }
                    }

                    if (
attacker.GuildID == attacked.GuildID && attacker.GuildID != 0)
                    {
                        
attacker.AttackPacket null;
                        return 
false;
                    }
                    if (
attacker.ClanId == attacked.ClanId && attacker.ClanId != 0)
                    {
                        
attacker.AttackPacket null;
                        return 
false;
                    }
                    if (
attacker.Owner.Friends.ContainsKey(attacked.UID))
                    {
                        
attacker.AttackPacket null;
                        return 
false;
                    }
                    if (
attacker.Owner.Guild != null)
                    {

                        if (
attacker.Owner.Guild.Ally != null)
                            if (
attacker.Owner.Guild.Ally.ContainsKey(attacked.GuildID))
                            {
                                
attacker.AttackPacket null;
                                return 
false;
                            }
                    }
                    if (
attacker.ClanId != 0)
                    {
                        var 
clan attacker.GetClan;
                        if (
clan != null)
                            if (
clan.Allies.ContainsKey(attacked.ClanId))
                            {
                                
attacker.AttackPacket null;
                                return 
false;
                            }
                    }
                }

                if (
spell != null)
                    if (
spell.OnlyGround)
                        if (
attacked.ContainsFlag(Update.Flags.Fly))
                            return 
false;

                if (
spell != null)
                    if (!
spell.CanKill)
                        return 
true;

                if (
attacker.PKMode != Mr_Panda.Game.Enums.PKMode.PK &&
                    
attacker.PKMode != Mr_Panda.Game.Enums.PKMode.Team && attacked.PKPoints 99)
                {
                    
attacker.AttackPacket null;
                    return 
false;
                }
                else
                {
                    if (!
attacked.ContainsFlag(Update.Flags.FlashingName))
                    {
                        if (!
attacked.ContainsFlag(Update.Flags.BlackName))
                        {
                            if (
Constants.PKFreeMaps.Contains(attacker.MapID))
                                return 
true;
                            if (
Constants.Damage1Map.Contains(attacker.MapID))
                                return 
true;
                            if (
attacker.Owner.Map.BaseID == 700)
                                return 
true;
                            
attacker.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
                            
attacker.FlashingNameStamp Time32.Now;
                            
attacker.FlashingNameTime 10;
                        }
                    }
                }
                return 
true;
            }
        }
        public static 
void CheckForExtraWeaponPowers(Client.GameState clientEntity attacked)
        {
            
#region Right Hand
            
var weapons client.Weapons;
            if (
weapons.Item1 != null)
            {
                if (
weapons.Item1.ID != 0)
                {
                    var 
Item weapons.Item1;
                    if (
Item.Effect != Enums.ItemEffect.None)
                    {
                        if (
Kernel.Rate(30))
                        {
                            switch (
Item.Effect)
                            {
                                case 
Enums.ItemEffect.HP:
                                    {
                                        
SpellUse spellUse = new SpellUse(true);
                                        
spellUse.Attacker 1;
                                        
spellUse.SpellID 1175;
                                        
spellUse.SpellLevel 4;
                                        
spellUse.client.Player.X;
                                        
spellUse.client.Player.Y;
                                        
spellUse.AddTarget(client.Player300null);
                                        
uint damage Math.Min(300client.Player.MaxHitpoints client.Player.Hitpoints);
                                        
client.Player.Hitpoints += damage;
                                        
client.SendScreen(spellUsetrue);
                                        break;
                                    }
                                case 
Enums.ItemEffect.MP:
                                    {
                                        
SpellUse spellUse = new SpellUse(true);
                                        
spellUse.Attacker 1;
                                        
spellUse.SpellID 1175;
                                        
spellUse.SpellLevel 2;
                                        
spellUse.client.Player.X;
                                        
spellUse.client.Player.Y;
                                        
spellUse.AddTarget(client.Player300null);
                                        
ushort damage = (ushort)Math.Min(300client.Player.MaxMana client.Player.Mana);
                                        
client.Player.Mana += damage;
                                        
client.SendScreen(spellUsetrue);
                                        break;
                                    }
                                case 
Enums.ItemEffect.Shield:
                                    {
                                        if (
client.Player.ContainsFlag(Update.Flags.MagicShield))
                                            return;
                                        
SpellUse spellUse = new SpellUse(true);
                                        
spellUse.Attacker 1;
                                        
spellUse.SpellID 1020;
                                        
spellUse.SpellLevel 0;
                                        
spellUse.client.Player.X;
                                        
spellUse.client.Player.Y;
                                        
spellUse.AddTarget(client.Player120null);
                                        
client.Player.ShieldTime 0;
                                        
client.Player.ShieldStamp Time32.Now;
                                        
client.Player.MagicShieldStamp Time32.Now;
                                        
client.Player.MagicShieldTime 0;

                                        
client.Player.AddFlag(Update.Flags.MagicShield);
                                        
client.Player.MagicShieldStamp Time32.Now;
                                        
client.Player.MagicShieldIncrease 1.1f;
                                        
client.Player.MagicShieldTime 120;
                                        if (
client.Player.EntityFlag == EntityFlag.Entity)
                                            
client.Send(Constants.Shield(2120));
                                        
client.SendScreen(spellUsetrue);
                                        break;
                                    }
                                case 
Enums.ItemEffect.Poison:
                                    {
                                        if (
attacked != null)
                                        {
                                            if (
Constants.PKForbiddenMaps.Contains(client.Player.MapID))
                                                return;
                                            if (
client.Map.BaseID == 700)
                                                return;
                                            if (
attacked.UID == client.Player.UID)
                                                return;
                                            if (
attacked.ToxicFogLeft 0)
                                                return;
                                            
SpellUse spellUse = new SpellUse(true);
                                            
spellUse.SpellID 5040;
                                            
spellUse.Attacker attacked.UID;
                                            
spellUse.SpellLevel 9;
                                            
spellUse.attacked.X;
                                            
spellUse.attacked.Y;
                                            
spellUse.AddTarget(attacked0null);
                                            
spellUse.Targets[attacked.UID].Hit true;
                                            
attacked.ToxicFogStamp Time32.Now;
                                            
attacked.ToxicFogLeft 10;
                                            
attacked.ToxicFogPercent 0.05F;
                                            
client.SendScreen(spellUsetrue);
                                        }
                                        break;
                                    }
                            }
                        }
                    }
                }
            }
            
#endregion
            #region Left Hand
            
if (weapons.Item2 != null)
            {
                if (
weapons.Item2.ID != 0)
                {
                    var 
Item weapons.Item2;
                    if (
Item.Effect != Enums.ItemEffect.None)
                    {
                        if (
Kernel.Rate(30))
                        {
                            switch (
Item.Effect)
                            {
                                case 
Enums.ItemEffect.HP:
                                    {
                                        
SpellUse spellUse = new SpellUse(true);
                                        
spellUse.Attacker 1;
                                        
spellUse.SpellID 1175;
                                        
spellUse.SpellLevel 4;
                                        
spellUse.client.Player.X;
                                        
spellUse.client.Player.Y;
                                        
spellUse.AddTarget(client.Player300null);
                                        
uint damage Math.Min(300client.Player.MaxHitpoints client.Player.Hitpoints);
                                        
client.Player.Hitpoints += damage;
                                        
client.SendScreen(spellUsetrue);
                                        break;
                                    }
                                case 
Enums.ItemEffect.MP:
                                    {
                                        
SpellUse spellUse = new SpellUse(true);
                                        
spellUse.Attacker 1;
                                        
spellUse.SpellID 1175;
                                        
spellUse.SpellLevel 2;
                                        
spellUse.client.Player.X;
                                        
spellUse.client.Player.Y;
                                        
spellUse.AddTarget(client.Player300null);
                                        
ushort damage = (ushort)Math.Min(300client.Player.MaxMana client.Player.Mana);
                                        
client.Player.Mana += damage;
                                        
client.SendScreen(spellUsetrue);
                                        break;
                                    }
                                case 
Enums.ItemEffect.Shield:
                                    {
                                        if (
client.Player.ContainsFlag(Update.Flags.MagicShield))
                                            return;
                                        
SpellUse spellUse = new SpellUse(true);
                                        
spellUse.Attacker 1;
                                        
spellUse.SpellID 1020;
                                        
spellUse.SpellLevel 0;
                                        
spellUse.client.Player.X;
                                        
spellUse.client.Player.Y;
                                        
spellUse.AddTarget(client.Player120null);
                                        
client.Player.ShieldTime 0;
                                        
client.Player.ShieldStamp Time32.Now;
                                        
client.Player.MagicShieldStamp Time32.Now;
                                        
client.Player.MagicShieldTime 0;

                                        
client.Player.AddFlag(Update.Flags.MagicShield);
                                        
client.Player.MagicShieldStamp Time32.Now;
                                        
client.Player.MagicShieldIncrease 1.1f;
                                        
client.Player.MagicShieldTime 120;
                                        if (
client.Player.EntityFlag == EntityFlag.Entity)
                                            
client.Send(Constants.Shield(2120));
                                        
client.SendScreen(spellUsetrue);
                                        break;
                                    }
                                case 
Enums.ItemEffect.Poison:
                                    {
                                        if (
attacked != null)
                                        {
                                            if (
attacked.UID == client.Player.UID)
                                                return;
                                            if (
Constants.PKForbiddenMaps.Contains(client.Player.MapID))
                                                return;
                                            if (
client.Map.BaseID == 700)
                                                return;
                                            if (
attacked.ToxicFogLeft 0)
                                                return;
                                            
SpellUse spellUse = new SpellUse(true);
                                            
spellUse.SpellID 5040;
                                            
spellUse.Attacker attacked.UID;
                                            
spellUse.SpellLevel 9;
                                            
spellUse.attacked.X;
                                            
spellUse.attacked.Y;
                                            
spellUse.AddTarget(attacked0null);
                                            
spellUse.Targets[attacked.UID].Hit true;
                                            
attacked.ToxicFogStamp Time32.Now;
                                            
attacked.ToxicFogLeft 10;
                                            
attacked.ToxicFogPercent 0.05F;
                                            
client.SendScreen(spellUsetrue);
                                        }
                                        break;
                                    }
                            }
                        }
                    }
                }
            }
            
#endregion

        
}
        public 
void CheckForSuperGems(Client.GameState client)
        {
            for (
uint i 112i++)
            {
                if (
!= 7)
                {
                    
ConquerItem item client.Equipment.TryGetItem(i);
                    if (
item != null && item.ID != 0)
                    {
                        if (
item.SocketOne != 0)
                        {
                            if (
item.SocketOne == Enums.Gem.SuperPhoenixGem)
                            {
                                if (
Kernel.Rate(3))
                                {
                                    
_String str = new _String(true);
                                    
str.UID attacker.UID;
                                    
str.TextsCount 1;
                                    
str.Type _String.Effect;
                                    
str.Texts.Add("phoenix");
                                    
attacker.Owner.SendScreen(strtrue);
                                }
                            }
                            if (
item.SocketOne == Enums.Gem.SuperDragonGem)
                            {
                                if (
Kernel.Rate(3)) //this is where your chances when to display the phoenix gem effect
                                
{
                                    
_String str = new _String(true);
                                    
str.UID attacker.UID;
                                    
str.TextsCount 1;
                                    
str.Type _String.Effect;
                                    
str.Texts.Add("dragon");
                                    
attacker.Owner.SendScreen(strtrue);
                                }
                            }
                        }
                    }
                }
            }
        }
    }




والسلام عليكم ورحمه الله وبركاتو بتمني دعوه حلوه او كلمه شكر تكفي

HBESA 2020-04-19 07:17 PM

رد: سستم اتاكات سرفر Devil Power فكسد 100%
 
عاش تسلم ايدك

ALz3em 2020-04-19 08:23 PM

رد: سستم اتاكات سرفر Devil Power فكسد 100%
 
عاش تسلم

Hassan Emprator 2020-04-19 09:00 PM

رد: سستم اتاكات سرفر Devil Power فكسد 100%
 
تسلم بوفتيقه هه

SourceDanger 2020-04-19 09:48 PM

رد: سستم اتاكات سرفر Devil Power فكسد 100%
 
الاتاك مليان هبد بصراحه

MahmoudMano 2020-04-20 12:21 AM

رد: سستم اتاكات سرفر Devil Power فكسد 100%
 
اقتباس:

المشاركة الأصلية كتبت بواسطة sourcedanger (المشاركة 38306)
الاتاك مليان هبد بصراحه

استخدمو وقللي هبد ولا لا وجرب كل الشخصيات

midoazoz 2020-04-20 12:29 AM

رد: سستم اتاكات سرفر Devil Power فكسد 100%
 
يا صحبي انتو مين قلكم ان الاتاك ده
يا جدعان اهم حاجه حسابات الاتاك مش دول
الارقام الي انت بتعمل ع الدامج دي اه هي بتعدل الاتاك بس متنفعش ممكن سورس تاني يكون الحسابات بتعته مختلفه + انت بتعدل حسابات والاسكلات خلاص بتتظبط تلقائيه

midodrkola 2020-04-20 02:35 PM

رد: سستم اتاكات سرفر Devil Power فكسد 100%
 
انضف شغل ولله تسلم يا مانو يارب يبقا فى شغل جديد

MahmoudMano 2020-04-20 03:49 PM

رد: سستم اتاكات سرفر Devil Power فكسد 100%
 
اقتباس:

المشاركة الأصلية كتبت بواسطة midoazoz (المشاركة 38355)
يا صحبي انتو مين قلكم ان الاتاك ده
يا جدعان اهم حاجه حسابات الاتاك مش دول
الارقام الي انت بتعمل ع الدامج دي اه هي بتعدل الاتاك بس متنفعش ممكن سورس تاني يكون الحسابات بتعته مختلفه + انت بتعدل حسابات والاسكلات خلاص بتتظبط تلقائيه

كل واحد ليه وجهه نظر ووجه مظرك احترمها بس انا بعتبر التعديل علي الاسكل اسهل واحسن بكتير بالنسباللي


الساعة الآن 09:34 PM

مرحبا بكم في منتدي اكواد لتطوير الالعاب