عرض مشاركة واحدة
قديم 2019-08-20, 11:59 AM
المشاركة 17
ابو مروان
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: مشكلة بخصوص اسكلة الويند ولكر thundercloud
بدل كلاس هندل ده بالي عندك

كود:
// ? Created by bode
// ? Copyright © 2010 - 2016 tq digital
// ? Emulator - project

using system;
using system.linq;
using system.text;
using system.drawing;
using mr.hamooo.network;
using mr.hamooo.database;
using mr.hamooo.interfaces;
using system.collections.generic;
using mr.hamooo.network.gamepackets;
using mr.hamooo.game.conquerstructures;
using davideid.game.features.event;
using davideid.game;

namespace 
mr.hamooo.game.attacking
{
    public 
unsafe class handle
    
{
        public static 
void stompermelee(msgmapitem itemushort spellid)
        {
            var 
attack item.attack;
            var 
spell database.spelltable.getspell(spelliditem.owner);
            
msgmagiceffect suse = new msgmagiceffect(true);
            
suse.attacker spellid == 12990 Item.uid Item.owner.player.uid;
            
suse.spellid spellid;
            
suse.spelllevel spell.level;
            
suse.specialeffect 1;
            if (
spellid == 12990)
            {
                
suse.item.x2;
                
suse.item.y2;
                foreach (
interfaces.imapobject _obj in item.owner.screen.objects)
                {
                    if (
_obj.mapobjtype == mapobjecttype.monster)
                    {
                        if (
_obj == null) continue;
                        var 
attacked1 _obj as player;
                        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))
                                {
                                    
uint damage game.attacking.calculate.melee(item.owner.playerattacked1ref attackspell) * (spell.power 30000) / 100;
                                    
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))
                                {
                                    
uint damage game.attacking.calculate.melee(item.owner.playerattacked1ref attackspell) * (spell.power 30000) / 100;
                                    
receiveattack(item.owner.playerattacked1attackref damagespell);
                                    
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 player;
                        if (
kernel.getdistance(item.xitem.yattacked1.xattacked1.y) <= spell.range)
                        {
                            if (
canattack(item.owner.playerattacked1spellfalse))
                            {
                                
uint damage game.attacking.calculate.melee(item.owner.playerattacked1ref attackspell) * (spell.power 30000) / 100;
                                
receiveattack(item.owner.playerattacked1attackref damagespell);
                                
suse.addtarget(attacked1.uiddamagenull);
                            }
                        }
                    }
                }
            }
            
item.owner.sendscreen(susetrue);
            
item.owner.player.attackpacket null;
        }
        public static 
void shadowofchaser(player attackerplayer attackedmsginteract attackbyte oneortwo)
        {
            
#region shadowofchaser(active)
            
imapobject lastattacked attacked;
            if (
oneortwo == 1)
            {
                if (
attacker.containsflag4((ulong)msgupdate.flags4.shadowofchaser) && attacker.ischaser2())
                {
                    
#region msgmapitem
                    
var map kernel.maps[attacker.mapid];
                    
network.gamepackets.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
                    
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;
                    while (
map.npcs.containskey(flooritem.uid))
                        
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;

                    
flooritem.itemid msgmapitem.shadowofchaser;
                    
flooritem.lastattacked.x;
                    
flooritem.mapid attacker.mapid;
                    
flooritem.lastattacked.y;
                    
flooritem.type msgmapitem.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);
                
msgmagiceffect suse = new msgmagiceffect(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(attackerattackedref attackspell) * (spell.power 30000) / 100;
                    
handle.receiveattack(attackerattackedattackref damagespell);
                    
suse.addtarget(attacked.uiddamagenull);
                }
                
attacker.owner.sendscreen(susetrue);
                
msgmagiceffect suse2 = new msgmagiceffect(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.player)
                    {
                        if (
_obj == null) continue;
                        var 
attacked1 _obj as player;
                        if (
lastattacked.uid == attacked1.uid) continue;
                        if (
kernel.getdistance(lastattacked.xlastattacked.yattacked1.xattacked1.y) <= 4)
                        {
                            if (
canattack(attackerattacked1spellfalse))
                            {
                                
uint damage game.attacking.calculate.melee(attackerattacked1ref attackspell) * (spell.power 30000) / 100;
                                
attack.damage damage;
                                
receiveattack(attackerattacked1attackref damagespell);
                                
suse2.addtarget(attacked1.uiddamagenull);
                            }
                        }
                    }
                }
                
attacker.owner.sendscreen(suse2true);
            }
            
#endregion
            
attacker.attackpacket null;
        }
        public static 
void cheakteam(client.gamestate clientnpcs dail)
        {
            if (
client.team == null)
                
client.player.teleport(1002430378);
            
client.player.addtopstatus((ulong)msgupdate.flags2.top3water2datetime.now.addminutes(30));
            
uint teamcount 0;
            foreach (
client.gamestate clients in kernel.gamepool.values.toarray())
            {
                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)(rates.alltops client.team.teammates.count());
                        foreach (
client.gamestate team in client.team.teammates)
                        {
                            
team.player.teleport(1002302276);
                            
team.player.conquerpoints += won;
                        }
                        
thread.lastteamfight false;
                        
kernel.sendworldmessage(new msgtalk("congratulations! " client.player.name " team has won last team standing and all team member got " won " cps"system.drawing.color.red2011), kernel.gamepool.values.toarray());
                    }
                    else
                    {
                        
dail.text("there are:| " + (teamcount lastcheak) + " |: Other player in other team kill him");
                        
dail.option("i will kill him "255);
                        
dail.send();
                    }
                }
            }
            else
            {
                
dail.text("there are:| " teamcount " |: Other player in other team kill him");
                
dail.option("i will kill him "255);
                
dail.send();
            }

        }
        private 
msginteract attack;
        private 
player attackerattacked;
        
#region interations
        
public class interactionrequest
        
{
            public 
interactionrequest(msginteract attackgame.player 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.interacttype 46;
                    
clienttarget.send(attack);
                    
clienttarget.send(attack);
                }
            }
        }
        public class 
interactioneffect
        
{
            public 
interactioneffect(msginteract attackgame.player 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.interacttype 47;
                        
attack.clienttarget.player.x;
                        
attack.clienttarget.player.y;
                        
clienttarget.send(attack);
                        
attack.interacttype 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(msginteract attackgame.player a_client)
            {

                
client.gamestate client a_client.owner;
                if (
client.player.containsflag((ulong)msgupdate.flags.ride))
                    
client.player.removeflag((ulong)msgupdate.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((ulong)msgupdate.flags.ride))
                        
clienttarget.player.removeflag((ulong)msgupdate.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.interacttype 47;
                            
attack.clienttarget.player.x;
                            
attack.clienttarget.player.y;
                            
attack.responsedamage clienttarget.interactioneffect;
                            
clienttarget.send(attack);
                            
attack.interacttype 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.interacttype 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.interacttype 49;
                            
client.sendscreen(attacktrue);
                            
attack.attacker client.player.uid;
                            
attack.attacked clienttarget.player.uid;
                            
client.sendscreen(attacktrue);
                        }
                    }
                }
            }
        }
        public class 
interactionstopeffect
        
{
            public 
interactionstopeffect(msginteract attackgame.player 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.interacttype 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(msginteract attackgame.player 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];
                    
attack.attacker clienttarget.player.uid;
                    
attack.interacttype 48;
                    
attack.clienttarget.player.x;
                    
attack.clienttarget.player.y;
                    
clienttarget.send(attack);
                    
clienttarget.player.interactiontype 0;
                    
clienttarget.player.interactionwith 0;
                    
clienttarget.player.interactioninprogress false;
                }
            }
        }
        
#endregion
        
private void execute()
        {
            
#region interactions
            
if (attack != null)
            {
                switch (
attack.interacttype)
                {
                    case 
msginteract.interactionrequest:
                        {
                            new 
interactionrequest(attackattacker); return;
                        }
                    case 
msginteract.interactioneffect:
                        {
                            new 
interactioneffect(attackattacker); return;
                        }
                    case 
msginteract.interactionaccept:
                        {
                            new 
interactionaccept(attackattacker); return;
                        }
                    case 
msginteract.interactionrefuse:
                        {
                            new 
interactionrefuse(attackattacker); return;
                        }
                    case 
msginteract.interactionstopeffect:
                        {
                            new 
interactionstopeffect(attackattacker); return;
                        }
                }
            }
            
#endregion
            #region monster -> player \ monster
            
if (attack == null)
            {
                if (
attacker.playerflag != playerflag.monster) return;
                if (
attacked == null) return;
                if (
attacker.companion && attacker.name != "thundercloud")
                {
                    if (
constants.pkforbiddenmaps.contains(attacker.mapid)) return;
                }
                if (
attacked.playerflag == playerflag.player)
                {
                    if (!
attacked.owner.attackable) return;
                    if (
attacked.dead) return;
                    if (
attacker.attackstamp.addmilliseconds(2000) < time32.now)
                    {
                        
attacker.attackstamp time32.now;
                        
#region snowbanhe
                        
if (attacker.name == "snowbanshee" || attacker.name == "snowbansheesoul" || attacker.name == "purplebanshee")
                        {

                            
uint rand = (uint)mr.hamooo.kernel.random.next(18);
                            switch (
rand)
                            {
                                case 
1:
                                    
Attacker.monsterinfo.spellid 10001;
                                    break;
                                case 
2:
                                    
Attacker.monsterinfo.spellid 30010;
                                    break;
                                case 
4:
                                    
Attacker.monsterinfo.spellid 30011;
                                    break;
                                case 
6:
                                    
Attacker.monsterinfo.spellid 30012;
                                    break;
                            }
                            
#region icethrom angercop
                            
if (attacker.monsterinfo.spellid == 30010 || attacker.monsterinfo.spellid == 10001)
                            {
                                
uint damage 0;
                                
damage += (uint)kernel.random.next(10002000);
                                if (
attacked.hitpoints <= damage)
                                {
                                    
attacked.die(attacker);
                                }
                                else
                                {
                                    
attacked.hitpoints -= damage;
                                }
                                if (
attacker.companion)
                                    
attacker.owner.increaseexperience(math.min(damageattacked.hitpoints), true);
                                
msgmagiceffect suse = new msgmagiceffect(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)
                            {
                                
msgmagiceffect suse = new msgmagiceffect(true);
                                
attack = new msginteract(true);
                                
attack.effect msginteract.interacteffects.none;
                                
uint damage 0;
                                
damage += (uint)kernel.random.next(10002000);
                                
suse.effect attack.effect;
                                if (
attacked.hitpoints <= damage)
                                {
                                    
attacked.die(attacker);
                                }
                                else
                                {
                                    
attacked.hitpoints -= damage;
                                    
attacked.owner.frightenstamp time32.now;
                                    var 
upd = new msgracetrackstatus(true);
                                    
upd.uid attacked.uid;
                                    
upd.add(msgracetrackstatus.flustered05);
                                    
attacked.owner.sendscreen(updtrue);
                                    
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);

                                }
                                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.player)
                                        {
                                            if (
obj.owner.player.containsflag((ulong)msgupdate.flags.dead)) continue;
                                            
attacked obj as player;
                                            if (
attacked.hitpoints <= damage)
                                            {
                                                
attacked.die(attacker);
                                            }
                                            else
                                            {
                                                
attacked.hitpoints -= damage;
                                                
attacked.owner.frightenstamp time32.now;
                                                var 
upd = new msgracetrackstatus(true);
                                                
upd.uid attacked.uid;
                                                
upd.add(msgracetrackstatus.flustered05);
                                                
attacked.owner.sendscreen(updtrue);
                                                
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);
                                            }

                                            
suse.addtarget(attacked.uiddamageattack);
                                        }
                                    }
                                }
                                
attacked.owner.sendscreen(susetrue);
                            }
                            
#endregion
                            #region angercrop
                            
if (attacker.monsterinfo.spellid == 30012)
                            {
                                
msgmagiceffect suse = new msgmagiceffect(true);
                                
attack = new msginteract(true);
                                
attack.effect msginteract.interacteffects.none;
                                
uint damage 0;
                                
damage += (uint)kernel.random.next(10002000);
                                
suse.effect attack.effect;
                                if (
attacked.hitpoints <= damage)
                                {
                                    
attacked.die(attacker);
                                }
                                else
                                {
                                    
attacked.hitpoints -= damage;
                                    
attacked.owner.player.frozenstamp time32.now;
                                    
attacked.owner.player.frozentime 5;
                                    
msgracetrackstatus update = new msgracetrackstatus(true);
                                    
update.uid attacked.uid;
                                    
update.add(msgracetrackstatus.freeze05);
                                    
attacked.owner.sendscreen(updatetrue);
                                    
attacked.addflag((ulong)msgupdate.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.player)
                                        {
                                            if (
obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
                                                continue;
                                            
attacked obj as player;
                                            if (
attacked.hitpoints <= damage)
                                            {
                                                
attacked.die(attacker);
                                            }
                                            else
                                            {
                                                
attacked.hitpoints -= damage;
                                                
attacked.owner.player.frozenstamp time32.now;
                                                
attacked.owner.player.frozentime 5;
                                                
msgracetrackstatus update = new msgracetrackstatus(true);
                                                
update.uid attacked.uid;
                                                
update.add(msgracetrackstatus.freeze05);
                                                
attacked.owner.sendscreen(updatetrue);
                                                
attacked.addflag((ulong)msgupdate.flags.freeze);
                                            }
                                            
suse.addtarget(attacked.uiddamageattack);
                                        }
                                    }
                                }
                                
attacked.owner.sendscreen(susetrue);
                            }
                            
#endregion
                        
}
                        
#endregion
                        #region nemesistyrant
                        
if (attacker.name == "nemesistyrant")
                        {
                            
uint rand = (uint)kernel.random.next(122);
                            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;
                                case 
5:
                                    
Attacker.monsterinfo.spellid 30011;
                                    break;
                                case 
6:
                                    
Attacker.monsterinfo.spellid 30012;
                                    break;
                                case 
7:
                                    
Attacker.monsterinfo.spellid 7014;
                                    break;
                                case 
8:
                                    
Attacker.monsterinfo.spellid 7017;
                                    break;
                                case 
9:
                                    
Attacker.monsterinfo.spellid 7017;
                                    break;
                                case 
10:
                                    
Attacker.monsterinfo.spellid 7012;
                                    break;
                                case 
11:
                                    
Attacker.monsterinfo.spellid 7013;
                                    break;
                                case 
12:
                                    
Attacker.monsterinfo.spellid 7015;
                                    break;
                                case 
13:
                                    
Attacker.monsterinfo.spellid 7016;
                                    break;
                                case 
14:
                                    
Attacker.monsterinfo.spellid 10502;
                                    break;
                                case 
15:
                                    
Attacker.monsterinfo.spellid 10504;
                                    break;
                                case 
16:
                                    
Attacker.monsterinfo.spellid 10506;
                                    break;
                                case 
17:
                                    
Attacker.monsterinfo.spellid 10505;
                                    break;
                                case 
18:
                                    
Attacker.monsterinfo.spellid 10500;
                                    break;
                                case 
19:
                                    
Attacker.monsterinfo.spellid 10363;
                                    break;
                                case 
20:
                                    
Attacker.monsterinfo.spellid 10360;
                                    
attacked.addflag((ulong)msgupdate.flags.stun);
                                    
attacked.shockstamp time32.now;
                                    
attacked.shock 5;
                                    var 
upd = new msgracetrackstatus(true);
                                    
upd.uid attacked.uid;
                                    
upd.add(msgracetrackstatus.dizzy05);
                                    
attacked.owner.sendscreen(updtrue);
                                    break;
                                case 
21:
                                    
Attacker.monsterinfo.spellid 10361;
                                    
attacked.addflag((ulong)msgupdate.flags.stun);
                                    
attacked.shockstamp time32.now;
                                    
attacked.shock 5;
                                    var 
upd1 = new msgracetrackstatus(true);
                                    
upd1.uid attacked.uid;
                                    
upd1.add(msgracetrackstatus.dizzy05);
                                    
attacked.owner.sendscreen(upd1true);
                                    break;
                                case 
22:
                                    
Attacker.monsterinfo.spellid 10362;
                                    break;
                            }
                            
#region icethrom angercop
                            
if (attacker.monsterinfo.spellid == 30010 || attacker.monsterinfo.spellid == 10001)
                            {
                                
uint damage 0;
                                
damage += (uint)kernel.random.next(10002000);
                                if (
attacked.hitpoints <= damage)
                                {
                                    
attacked.die(attacker);
                                }
                                else
                                {
                                    
attacked.hitpoints -= damage;
                                }
                                if (
attacker.companion)
                                    
attacker.owner.increaseexperience(math.min(damageattacked.hitpoints), true);
                                
msgmagiceffect suse = new msgmagiceffect(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)
                            {
                                
msgmagiceffect suse = new msgmagiceffect(true);
                                
attack = new msginteract(true);
                                
attack.effect msginteract.interacteffects.none;
                                
uint damage 0;
                                
damage += (uint)kernel.random.next(10002000);
                                
suse.effect attack.effect;
                                if (
attacked.hitpoints <= damage)
                                {
                                    
attacked.die(attacker);
                                }
                                else
                                {
                                    
attacked.hitpoints -= damage;
                                    
attacked.owner.frightenstamp time32.now;
                                    var 
upd = new msgracetrackstatus(true);
                                    
upd.uid attacked.uid;
                                    
upd.add(msgracetrackstatus.flustered05);
                                    
attacked.owner.sendscreen(updtrue);
                                    
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);

                                }
                                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.player)
                                        {
                                            if (
obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
                                                continue;
                                            
attacked obj as player;
                                            if (
attacked.hitpoints <= damage)
                                            {
                                                
attacked.die(attacker);
                                            }
                                            else
                                            {
                                                
attacked.hitpoints -= damage;
                                                
attacked.owner.frightenstamp time32.now;
                                                var 
upd = new msgracetrackstatus(true);
                                                
upd.uid attacked.uid;
                                                
upd.add(msgracetrackstatus.flustered05);
                                                
attacked.owner.sendscreen(updtrue);
                                                
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);
                                            }

                                            
suse.addtarget(attacked.uiddamageattack);
                                        }
                                    }
                                }
                                
attacked.owner.sendscreen(susetrue);
                            }
                            
#endregion
                            #region angercrop
                            
if (attacker.monsterinfo.spellid == 30012)
                            {
                                
msgmagiceffect suse = new msgmagiceffect(true);
                                
attack = new msginteract(true);
                                
attack.effect msginteract.interacteffects.none;
                                
uint damage 0;
                                
damage += (uint)kernel.random.next(10002000);
                                
suse.effect attack.effect;
                                if (
attacked.hitpoints <= damage)
                                {
                                    
attacked.die(attacker);
                                }
                                else
                                {
                                    
attacked.hitpoints -= damage;
                                    
attacked.owner.player.frozenstamp time32.now;
                                    
attacked.owner.player.frozentime 5;
                                    
msgracetrackstatus update = new msgracetrackstatus(true);
                                    
update.uid attacked.uid;
                                    
update.add(msgracetrackstatus.freeze05);
                                    
attacked.owner.sendscreen(updatetrue);
                                    
attacked.addflag((ulong)msgupdate.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.player)
                                        {
                                            if (
obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
                                                continue;
                                            
attacked obj as player;
                                            if (
attacked.hitpoints <= damage)
                                            {
                                                
attacked.die(attacker);
                                            }
                                            else
                                            {
                                                
attacked.hitpoints -= damage;
                                                
attacked.owner.player.frozenstamp time32.now;
                                                
attacked.owner.player.frozentime 5;
                                                
msgracetrackstatus update = new msgracetrackstatus(true);
                                                
update.uid attacked.uid;
                                                
update.add(msgracetrackstatus.freeze05);
                                                
attacked.owner.sendscreen(updatetrue);
                                                
attacked.addflag((ulong)msgupdate.flags.freeze);
                                            }

                                            
suse.addtarget(attacked.uiddamageattack);
                                        }
                                    }
                                }
                                
attacked.owner.sendscreen(susetrue);
                            }
                            
#endregion
                        
}
                        
#endregion
                        #region treatodragon
                        
if (attacker.name == "teratodragon" || attacker.name == "lavabeast" || attacker.name == "shadowclone")
                        {
                            
uint rand = (uint)mr.hamooo.kernel.random.next(17);
                            switch (
rand)
                            {
                                case 
1:
                                    
Attacker.monsterinfo.spellid 7014;
                                    break;
                                case 
2:
                                    
Attacker.monsterinfo.spellid 7017;
                                    break;
                                case 
3:
                                    
Attacker.monsterinfo.spellid 7017;
                                    break;
                                case 
4:
                                    
Attacker.monsterinfo.spellid 7012;
                                    break;
                                case 
5:
                                    
Attacker.monsterinfo.spellid 7013;
                                    break;
                                case 
6:
                                    
Attacker.monsterinfo.spellid 7015;
                                    break;
                                case 
7:
                                    
Attacker.monsterinfo.spellid 7016;
                                    break;
                            }
                            
#region td area
                            
if (attacker.monsterinfo.spellid == 7014 || attacker.monsterinfo.spellid == 7017)
                            {
                                
msgmagiceffect suse = new msgmagiceffect(true);
                                
attack = new msginteract(true);
                                
attack.effect msginteract.interacteffects.none;
                                
uint damage 0;
                                
damage += (uint)kernel.random.next(10002000);
                                
suse.effect attack.effect;
                                if (
attacked.hitpoints <= damage)
                                {
                                    
attacked.die(attacker);
                                }
                                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(attacked.uiddamageattack);
                                foreach (var 
obj in attacked.owner.screen.objects)
                                {
                                    if (
calculations.inbox(obj.xobj.yattacker.xattacker.y14))
                                    {
                                        if (
obj.mapobjtype == mapobjecttype.player)
                                        {
                                            if (
obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
                                                continue;
                                            
attacked obj as player;
                                            if (
attacked.hitpoints <= damage)
                                            {
                                                
attacked.die(attacker);
                                            }
                                            else
                                            {
                                                
attacked.hitpoints -= damage;
                                            }

                                            
suse.addtarget(attacked.uiddamageattack);
                                        }
                                    }
                                }
                                
attacked.owner.sendscreen(susetrue);
                            }
                        }
                            
#endregion
                        #region 2nd skill
                        
if (attacker.monsterinfo.spellid == 7013)
                        {
                            
msgmagiceffect suse = new msgmagiceffect(true);
                            
attack = new msginteract(true);
                            
attack.effect msginteract.interacteffects.none;
                            
uint damage 0;
                            
damage += (uint)kernel.random.next(10002000);
                            
suse.effect attack.effect;
                            if (
attacked.hitpoints <= damage)
                            {
                                
attacked.die(attacker);
                            }
                            else
                            {
                                
attacked.hitpoints -= damage;
                                
attacked.owner.frightenstamp time32.now;
                                
attacked.owner.player.fright 5;
                                var 
upd = new msgracetrackstatus(true);
                                
upd.uid attacked.uid;
                                
upd.add(msgracetrackstatus.dizzy05);
                                
attacked.owner.sendscreen(updtrue);
                                
attacked.owner.player.addflag((ulong)msgupdate.flags.freezesmall);
                            }
                            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.player)
                                    {
                                        if (
obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
                                            continue;
                                        
attacked obj as player;
                                        if (
attacked.hitpoints <= damage)
                                        {
                                            
attacked.die(attacker);
                                        }
                                        else
                                        {
                                            
attacked.hitpoints -= damage;
                                            
attacked.owner.frightenstamp time32.now;
                                            
attacked.owner.player.fright 5;
                                            var 
upd = new msgracetrackstatus(true);
                                            
upd.uid attacked.uid;
                                            
upd.add(msgracetrackstatus.dizzy05);
                                            
attacked.owner.sendscreen(updtrue);
                                            
attacked.owner.player.addflag((ulong)msgupdate.flags.freezesmall);
                                        }

                                        
suse.addtarget(attacked.uiddamageattack);
                                    }
                                }
                            }
                            
attacked.owner.sendscreen(susetrue);
                        }
                        
#endregion
                        #region chill
                        
if (attacker.monsterinfo.spellid == 7015)
                        {
                            
msgmagiceffect suse = new msgmagiceffect(true);
                            
attack = new msginteract(true);
                            
attack.effect msginteract.interacteffects.none;
                            
uint damage 0;
                            
damage += (uint)kernel.random.next(10002000);
                            
suse.effect attack.effect;
                            if (
attacked.hitpoints <= damage)
                            {
                                
attacked.die(attacker);
                            }
                            else
                            {
                                
attacked.hitpoints -= damage;
                                
attacked.owner.frightenstamp time32.now;
                                var 
upd = new msgracetrackstatus(true);
                                
upd.uid attacked.uid;
                                
upd.add(msgracetrackstatus.flustered05);
                                
attacked.owner.sendscreen(updtrue);
                                
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);

                            }
                            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.player)
                                    {
                                        if (
obj.owner.player.containsflag((ulong)msgupdate.flags.dead))
                                            continue;
                                        
attacked obj as player;
                                        if (
attacked.hitpoints <= damage)
                                        {
                                            
attacked.die(attacker);
                                        }
                                        else
                                        {
                                            
attacked.hitpoints -= damage;
                                            
attacked.owner.frightenstamp time32.now;
                                            var 
upd = new msgracetrackstatus(true);
                                            
upd.uid attacked.uid;
                                            
upd.add(msgracetrackstatus.flustered05);
                                            
attacked.owner.sendscreen(updtrue);
                                            
attacked.owner.player.addflag((ulong)msgupdate.flags.chaoscycle);
                                        }

                                        
suse.addtarget(attacked.uiddamageattack);
                                    }
                                }
                            }
                            
attacked.owner.sendscreen(susetrue);
                        }
                        
#endregion
                        #endregion
                        #region swordmaster
                        
if (attacker.name == "swordmaster" || attacker.name == "hollowbeast")
                        {
                            
uint rand = (uint)mr.hamooo.kernel.random.next(15);
                            switch (
rand)
                            {
                                case 
1:
                                    
Attacker.monsterinfo.spellid 10502;
                                    break;
                                case 
2:
                                    
Attacker.monsterinfo.spellid 10504;
                                    break;
                                case 
3:
                                    
Attacker.monsterinfo.spellid 10506;
                                    break;
                                case 
4:
                                    
Attacker.monsterinfo.spellid 10505;
                                    break;
                                case 
5:
                                    
Attacker.monsterinfo.spellid 10500;
                                    break;
                            }
                            
uint damage 0;
                            
damage += (uint)kernel.random.next(10002000);

                            if (
attacked.hitpoints <= damage)
                                
attacked.die(attacker);
                            else
                                
attacked.hitpoints -= damage;
                            if (
attacker.companion)
                                
attacker.owner.increaseexperience(math.min(damageattacked.hitpoints), true);
                            
msgmagiceffect suse = new msgmagiceffect(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 thrillingspook
                        
if (attacker.name == "thrillingspook" || attacker.name == "thrillingspook2" || attacker.name == "thrillingspook3")
                        {
                            
uint rand = (uint)kernel.random.next(17);
                            switch (
rand)
                            {
                                case 
1Attacker.monsterinfo.spellid 10363; break;
                                case 
2:
                                    {
                                        if (!
attacked.containsflag((ulong)msgupdate.flags.stun))
                                        {
                                            
attacker.monsterinfo.spellid 10360;
                                            
attacked.addflag((ulong)msgupdate.flags.stun);
                                            
attacked.shockstamp time32.now;
                                            
attacked.shock 5;
                                            var 
upd = new msgracetrackstatus(true);
                                            
upd.uid attacked.uid;
                                            
upd.add(msgracetrackstatus.soulshacle05);
                                            
attacked.owner.sendscreen(updtrue);
                                        }
                                        break;
                                    }
                                case 
3Attacker.monsterinfo.spellid 10362; break;
                                case 
4Attacker.monsterinfo.spellid 10363; break;
                                case 
5Attacker.monsterinfo.spellid 10363; break;
                                case 
6Attacker.monsterinfo.spellid 10362; break;
                                case 
7:
                                    If (!
attacked.containsflag((ulong)msgupdate.flags.stun))
                                    {
                                        
attacker.monsterinfo.spellid 10361;
                                        
attacked.addflag((ulong)msgupdate.flags.stun);
                                        
attacked.shockstamp time32.now;
                                        
attacked.shock 5;
                                        var 
upd1 = new msgracetrackstatus(true);
                                        
upd1.uid attacked.uid;
                                        
upd1.add(msgracetrackstatus.soulshacle05);
                                        
attacked.owner.sendscreen(upd1true);
                                    }
                                    break;
                            }
                            
uint damage 0;
                            
damage += (uint)kernel.random.next(10002000);
                            if (
attacked.hitpoints <= damage)
                            {
                                
attacked.die(attacker);
                            }
                            else
                            {
                                
attacked.hitpoints -= damage;
                            }
                            if (
attacker.companion)
                                
attacker.owner.increaseexperience(math.min(damageattacked.hitpoints), true);
                            
msgmagiceffect suse = new msgmagiceffect(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 thundercloud
                        
if (attacker.name == "thundercloud")
                        {
                            if (
attacker.owner.player.pkmode != game.enums.pkmode.pk &&
                         
attacker.owner.player.pkmode != game.enums.pkmode.team) return;
                            if (
kernel.gamepool.containskey(attacker.owneruid))
                            {
                                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 msginteract(true);
                                
attack.attacker attacker.uid;
                                
attack.attacked attacked.uid;
                                
attack.interacttype network.gamepackets.msginteract.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);
                                
msgmagiceffect suse2 = new msgmagiceffect(true);
                                
suse2.attacker attacker.uid;
                                
suse2.attacker1 attacked.uid;
                                
suse2.spellid 13190;
                                
suse2.attacked.x;
                                
suse2.attacked.y;
                                
suse2.addtarget(attacked.uiddamage2attack);
                                
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
                        
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
                        #region guard
                        
if (attacker.name == "guard1")
                        {
                            
uint rand = (uint)kernel.random.next(115);
                            switch (
rand)
                            {
                                case 
1:
                                    
Attacker.monsterinfo.spellid 7012;
                                    break;
                                case 
2:
                                    
Attacker.monsterinfo.spellid 7013;
                                    break;
                                case 
3:
                                    
Attacker.monsterinfo.spellid 7015;
                                    break;
                                case 
4:
                                    
Attacker.monsterinfo.spellid 7016;
                                    break;
                                case 
5:
                                    
Attacker.monsterinfo.spellid 7017;
                                    break;
                                case 
6:
                                    
Attacker.monsterinfo.spellid 10001;
                                    break;
                                case 
7:
                                    
Attacker.monsterinfo.spellid 10363;
                                    break;
                                case 
8:
                                    
Attacker.monsterinfo.spellid 10362;
                                    break;
                                case 
9:
                                    
Attacker.monsterinfo.spellid 10502;
                                    break;
                                case 
10:
                                    
Attacker.monsterinfo.spellid 10504;
                                    break;
                                case 
11:
                                    
Attacker.monsterinfo.spellid 10506;
                                    break;
                                case 
12:
                                    
Attacker.monsterinfo.spellid 10505;
                                    break;
                                case 
13:
                                    
Attacker.monsterinfo.spellid 30012;
                                    break;
                                case 
14:
                                    
Attacker.monsterinfo.spellid 10001;
                                    break;
                                case 
15:
                                    
Attacker.monsterinfo.spellid 30015;
                                    break;
                            }
                            
uint damage 0;
                            
damage += (uint)kernel.random.next(5000060000);
                            if (
attacked == null)
                                return;
                            if (
attacked.hitpoints <= damage)
                            {
                                
attacked.die(attacker);
                            }
                            else
                            {
                                
attacked.hitpoints -= damage;
                            }
                            if (
attacker.companion)
                                
attacker.owner.increaseexperience(math.min(damageattacked.hitpoints), true);
                            
msgmagiceffect suse = new msgmagiceffect(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
                    
}
                    
attack = new msginteract(true);
                    
attack.effect msginteract.interacteffects.none;
                    
attack.attacker attacker.uid;
                    
attack.attacked attacker.monsterinfo.id;
                    
attack.attacked.x;
                    
attack.attacked.y;
                    
attack.interacttype msginteract.showusespell;
                    
attack.monsterspellid attacker.monsterinfo.spellid;
                    
attacker.monsterinfo.sendscreen(attack);
                    if (
attacker.monsterinfo.spellid == 0)
                    {
                        
attack = new msginteract(true);
                        
attack.effect msginteract.interacteffects.none;

                        
uint damage calculate.melee(attackerattackedref attack);
                        
#region revengetaill
                        
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.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)
                                {
                                    
msgmagiceffect suses = new msgmagiceffect(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

                        
attack.attacker attacker.uid;
                        
attack.attacked attacked.uid;
                        
attack.interacttype msginteract.melee;
                        
attack.damage damage;
                        
attack.attacked.x;
                        
attack.attacked.y;
                        if (
attacked.hitpoints <= damage)
                        {
                            if (
attacked.inhangup)
                            {
                                
msghangup autohunt = new msghangup();
                                
autohunt.action msghangup.mode.killedby;
                                
autohunt.unknown 3329;
                                
autohunt.killedname attacker.monsterinfo.name;
                                
autohunt.expgained attacked.hangupexp;
                                
attacked.owner.send(autohunt.toarray());
                                
attacked.autorevstamp time32.now;
                                
attacked.autorev 20;
                            }
                            
attacked.owner.sendscreen(attacktrue);
                            
attacked.die(attacker.uid);
                        }
                        else
                        {
                            
attacked.hitpoints -= damage;
                            
attacked.owner.sendscreen(attacktrue);
                        }
                    }
                    else
                    {
                        
msgmagiceffect suse = new msgmagiceffect(true);
                        
attack = new msginteract(true);
                        
attack.effect msginteract.interacteffects.none;
                        
uint damage calculate.magic(attackerattackedattacker.monsterinfo.spellid0ref attack);
                        
#region revengetaill
                        
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.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)
                                {
                                    
msgmagiceffect suses = new msgmagiceffect(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

                        
suse.effect attack.effect;
                        if (
attacked.hitpoints <= damage)
                        {
                            
attacked.die(attacker.uid);
                            if (
attacked.inhangup)
                            {
                                
msghangup autohunt = new msghangup();
                                
autohunt.action msghangup.mode.killedby;
                                
autohunt.unknown 3329;
                                
autohunt.killedname attacker.monsterinfo.name;
                                
autohunt.expgained attacked.hangupexp;
                                
attacked.owner.send(autohunt.toarray());
                                
attacked.autorevstamp time32.now;
                                
attacked.autorev 20;
                            }
                        }
                        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(attacked.uiddamageattack);
                        
attacked.owner.sendscreen(susetrue);
                    }
                }
                else
                {
                    if (
attacker.monsterinfo.spellid == 0)
                    {
                        
attack = new msginteract(true);
                        
attack.effect msginteract.interacteffects.none;
                        
uint damage calculate.melee(attackerattackedref attack);
                        
#region revengetaill
                        
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.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)
                                {
                                    
msgmagiceffect suses = new msgmagiceffect(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

                        
attack.attacker attacker.uid;
                        
attack.attacked attacked.uid;
                        
attack.interacttype msginteract.melee;
                        
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 msginteract(true);
                            
attack.attacker attacker.uid;
                            
attack.attacked attacked.uid;
                            
attack.interacttype network.gamepackets.msginteract.kill;
                            
attack.attacked.x;
                            
attack.attacked.y;
                            
attacked.monsterinfo.sendscreen(attack);
                        }
                        else
                        {
                            
attacked.hitpoints -= damage;
                        }
                    }
                    else
                    {
                        
msgmagiceffect suse = new msgmagiceffect(true);
                        
attack = new msginteract(true);
                        
attack.effect msginteract.interacteffects.none;
                        
#region thundercloud
                        
if (attacker.name == "thundercloud")
                        {
                            if (
attacker.owner.player.pkmode != game.enums.pkmode.pk &&
                        
attacker.owner.player.pkmode != game.enums.pkmode.team) return;
                            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 attack) * (spell.level Spell.firstdamage 50) / 100);
                                if (
attacker.spawnpacket[50] == 128)
                                    
damage2 = (uint)(damage2 spell2.firstdamage);
                                
msgmagiceffect suse2 = new msgmagiceffect(true);
                                
suse2.attacker attacker.uid;
                                
suse2.attacker1 attacked.uid;
                                
suse2.spellid 13190;
                                
suse2.attacked.x;
                                
suse2.attacked.y;
                                
suse2.addtarget(attacked.uiddamage2attack);
                                
attacker.monsterinfo.sendscreen(suse2);
                                if (
attacked.hitpoints <= damage2)
                                {
                                    
attacked.die(attacker);
                                    
attack = new msginteract(true);
                                    
attack.attacker attacker.uid;
                                    
attack.attacked attacked.uid;
                                    
attack.interacttype network.gamepackets.msginteract.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.magic(attackerattackedattacker.monsterinfo.spellid0ref attack);
                        
#region revengetaill
                        
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.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)
                                {
                                    
msgmagiceffect suses = new msgmagiceffect(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

                        
suse.effect attack.effect;
                        
suse.attacker attacker.uid;
                        
suse.spellid attacker.monsterinfo.spellid;
                        
suse.attacked.x;
                        
suse.attacked.y;
                        
suse.addtarget(attacked.uiddamageattack);
                        
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 msginteract(true);
                            
attack.attacker attacker.uid;
                            
attack.attacked attacked.uid;
                            
attack.interacttype network.gamepackets.msginteract.kill;
                            
attack.attacked.x;
                            
attack.attacked.y;
                            
attacked.monsterinfo.sendscreen(attack);
                        }
                        else
                        {
                            
attacked.hitpoints -= damage;
                        }
                    }
                }
            }
            
#endregion
            #region player -> player \ monster \ sob npc
            
else
            {
                
#region merchant
                
if (attack.interacttype == msginteract.merchantaccept || attack.interacttype == msginteract.merchantrefuse)
                {
                    
attacker.attackpacket null; return;
                }
                
#endregion
                #region marriage
                
if (attack.interacttype == msginteract.marriageaccept || attack.interacttype == msginteract.marriagerequest)
                {
                    if (
attack.interacttype == msginteract.marriagerequest)
                    {
                        
client.gamestate spouse null;
                        
uint takeout attack.attacked;
                        if (
takeout == attacker.uid)
                            
takeout attack.attacker;
                        if (
kernel.gamepool.trygetvalue(takeoutout spouse))
                        {
                            
msgrelation relation = new msgrelation();
                            
relation.requester attacker.uid;
                            
relation.receiver spouse.player.uid;
                            
relation.level attacker.level;
                            
relation.battlepower = (uint)attacker.battlepower;
                            
relation.spouse attacker.name == spouse.player.spouse;
                            
relation.friend attacker.owner.friends.containskey(spouse.player.uid);
                            
relation.tradepartner attacker.owner.partners.containskey(spouse.player.uid);
                            if (
attacker.owner.mentor != null)
                                
relation.mentor attacker.owner.mentor.id == spouse.player.uid;
                            
relation.apprentice attacker.owner.apprentices.containskey(spouse.player.uid);
                            if (
attacker.owner.team != null)
                                
relation.teammate attacker.owner.team.isteammate(spouse.player.uid);
                            if (
attacker.owner.guild != null)
                                
relation.guildmember attacker.owner.guild.members.containskey(spouse.player.uid);
                            
relation.enemy attacker.owner.enemy.containskey(spouse.player.uid);
                            
spouse.send(relation);

                            if (
attacker.spouse != "none" || spouse.player.spouse != "none")
                            {
                                
attacker.owner.send(new msgtalk("you cannot marry someone that is already married with someone else!"color.blackmsgtalk.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 msgtalk("you cannot marry someone of your gender!"color.blackmsgtalk.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 msgtalk("you cannot marry someone that is already married with someone else!"color.blackmsgtalk.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;
                                    
msgtalk message null;
                                    if (
spouse.player.mesh 10 >= 3)
                                        
message = new msgtalk("joy and happiness! " spouse.player.name " and " attacker.name " have joined together in the holy marriage. We wish them a stone house."color.burlywoodmsgtalk.center);
                                    else 
message = new msgtalk("joy and happiness! " attacker.name " and " attacker.spouse " have joined together in the holy marriage. We wish them a stone house."color.burlywoodmsgtalk.center);
                                    foreach (
client.gamestate client in server.gamepool)
                                    {
                                        
client.send(message);
                                    }
                                    
spouse.player.update(msgname.mode.effect"firework-2love"true);
                                    
attacker.update(msgname.mode.effect"firework-2love"true);
                                }
                                else
                                {
                                    
attacker.owner.send(new msgtalk("you cannot marry someone of your gender!"system.drawing.color.blackmsgtalk.topleft));
                                }
                            }
                        }
                    }
                }
                
#endregion
                #region attacking
                
else
                {
                    
attacker.owner.attackable true;
                    
player attacked null;
                    
msgnpcinfoex attackedsob null;
                    
msgmapitem attackeditem null;
                    
#region checks
                    
if (attack.attacker != attacker.uid) return;
                    if (
attacker.playerflag != playerflag.player) return;
                    
attacker.removeflag((ulong)msgupdate.flags.invisibility);
                    
bool pass false;
                    if (
attack.interacttype == msginteract.melee)
                    {
                        if (
attacker.onfatalstrike())
                        {
                            if (
attack.attacked 600000)
                            {
                                
pass true;
                            }
                        }
                    }
                    
ushort decrease 0;
                    if (
attacker.oncyclone())
                        
decrease 1;
                    if (
attacker.onsuperman())
                        
decrease 300;
                    if (!
pass && attack.interacttype != msginteract.magic)
                    {
                       
int milliseconds 1000 attacker.agility 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;
                        }
                    }
                    
bool dowep1spell falsedowep2spell false;
                
restart:
                    
#region extract attack information
                    
ushort spellid 000;
                    
uint target 0;
                    if (
attack.interacttype == msginteract.magic)
                    {
                        if (!
attack.decoded)
                        {
                            
#region getskillid
                            
spellid convert.touint16(((long)attack.toarray()[24 4] & 0xff) | (((long)attack.toarray()[25 4] & 0xff) << 8));
                            
spellid ^= (ushort)0x915d;
                            
spellid ^= (ushort)attacker.uid;
                            
spellid = (ushort)(spellid << 0x3 spellid >> 0xd);
                            
spellid -= 0xeb42;
                            
#endregion
                            #region getcoords
                            
= (ushort)((attack.toarray()[16 4] & 0xff) | ((attack.toarray()[17 4] & 0xff) << 8));
                            
= (ushort)(^ (uint)(attacker.uid 0xffff) ^ 0x2ed6);
                            
= (ushort)(((<< 1) | ((0x8000) >> 15)) & 0xffff);
                            
= (ushort)((0xffff0000) - 0xffff22ee);
                            
= (ushort)((attack.toarray()[18 4] & 0xff) | ((attack.toarray()[19 4] & 0xff) << 8));
                            
= (ushort)(^ (uint)(attacker.uid 0xffff) ^ 0xb99b);
                            
= (ushort)(((<< 5) | ((0xf800) >> 11)) & 0xffff);
                            
= (ushort)((0xffff0000) - 0xffff8922);
                            
#endregion
                            #region gettarget
                            
target = ((uint)attack.toarray()[12 4] & 0xff) | (((uint)attack.toarray()[13 4] & 0xff) << 8) | (((uint)attack.toarray()[14 4] & 0xff) << 16) | (((uint)attack.toarray()[15 4] & 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.interacttype == msginteract.magic)
                    {
                        if (!(
dowep1spell || dowep2spell))
                        {
                            if (
spellid == 1045 || spellid == 1046 || spellid == 11005 || spellid == 11000 || spellid == 1100)
                            {
                            }
                            else
                            {
                                
int milliseconds 1000 attacker.agility decrease;
                                if (
milliseconds || milliseconds 5000)
                                    
milliseconds 0;
                                if (
time32.now attacker.attackstamp.addmilliseconds(milliseconds)) return;
                            }
                            
attacker.attackstamp time32.now;
                        }
                    }
                    
#endregion
                    
if (attacker.owner.screen.trygetflooritem(targetout attackeditem))
                    {
                        
lotusattack(attackeditemattackerattack);
                        return;
                    }
                    if (
attacker.mapid == steedrace.mapid)
                    {
                        if (
attacker.containsflag((ulong)msgupdate.flags.ride))
                        {
                            
quitsteedrace(attacker);
                        }
                        return;
                    }
                    if (
attacker.containsflag((ulong)msgupdate.flags.ride) && attacker.owner.equipment.trygetitem(18) == null)
                    {
                        if (
attack.interacttype != msginteract.magic)
                            
attacker.removeflag((ulong)msgupdate.flags.ride);
                        else if (!(
spellid == 7003 || spellid == 7002))
                            
attacker.removeflag((ulong)msgupdate.flags.ride);
                    }
                    if (
attacker.containsflag((ulong)msgupdate.flags.castpray))
                        
attacker.removeflag((ulong)msgupdate.flags.castpray);
                    if (
attacker.containsflag((ulong)msgupdate.flags.praying))
                        
attacker.removeflag((ulong)msgupdate.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;
                        
map.updatecoordonatesforangle(ref xref y, (enums.conquerangle)target);
                        foreach (
imapobject obj in attacker.owner.screen.objects)
                        {
                            if (
obj == null) continue;
                            if (
obj.== && obj.== && (obj.mapobjtype == mapobjecttype.monster || obj.mapobjtype == mapobjecttype.player))
                            {
                                
player player obj as player;
                                if (!
player.dead)
                                {
                                    
target obj.uid;
                                    break;
                                }
                            }
                        }
                    }
                    
#endregion
                    #region counterkill
                    
if (attack.interacttype == msginteract.counterkillswitch)
                    {
                        if (
attacked != null)
                            if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                            {
                                
attacker.attackpacket null; return;
                            }
                        if (
attacker != null)
                            if (
attacker.containsflag((ulong)msgupdate.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;
                                    
msginteract m_attack = new msginteract(true);
                                    
m_attack.attacked attacker.uid;
                                    
m_attack.attacker attacker.uid;
                                    
m_attack.interacttype msginteract.counterkillswitch;
                                    
m_attack.damage 1;
                                    
m_attack.attacker.x;
                                    
m_attack.attacker.y;
                                    
m_attack.send(attacker.owner);
                                }
                            }
                            else
                            {
                                
attacker.counterkillswitch false;
                                
msginteract m_attack = new msginteract(true);
                                
m_attack.attacked attacker.uid;
                                
m_attack.attacker attacker.uid;
                                
m_attack.interacttype msginteract.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.interacttype == msginteract.melee)
                    {
                        if (
attacker.isbowequipped)
                        {
                            
attack.interacttype msginteract.ranged;
                            new 
game.attacking.handle(attackattackerattacked);
                            return;
                        }
                        if (
attacker.owner.screen.trygetvalue(attack.attackedout attacked))
                        {
                            var 
spell spelltable.getspell(attack.spellid0);
                            if (
attacker.owner.spells.containskey(attack.spellid))
                                
spell spelltable.getspell(attack.spellidattacker.owner.spells[attack.spellid].level);
                            if (
attack.spellid == 12580 ||
                                
attack.spellid == 12590 ||
                                
attack.spellid == 12600 ||
                                
attack.spellid == 12570 ||
                                
attack.spellid == 12220 ||
                                
attack.spellid == 12210)
                                
attack.interacttype msginteract.magic;
                            switch (
attack.spellid)
                            {
                                
#region upsweep
                                
case 12580://up                               
                                    
{
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            if (
attacked == null)
                                                return;
                                            var 
angle kernel.getangle(attacker.xattacker.yattacked.xattacked.y);
                                            
map.updatecoordonatesforangle(ref xref yangle);

                                            
fan sector = new fan(attacker.xattacker.yxyspell.rangespell.sector);

                                            foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
kernel.getdistance(attacker.xattacker.y_obj.x_obj.y) <= 7)
                                                {
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;

                                                        if (
sector.isinfan(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                                
damage = (uint)(damage 0.6);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;

                                                        if (
sector.isinfan(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);

                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }

                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region downsweep
                                
case 12590://down                                                          
                                    
{
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            if (
attacked == null)
                                                return;
                                            var 
angle kernel.getangle(attacker.xattacker.yattacked.xattacked.y);
                                            
angle enums.oppositeangle(angle);
                                            
map.updatecoordonatesforangle(ref xref yangle);

                                            
fan sector = new fan(attacker.xattacker.yxyspell.rangespell.sector);

                                            foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
kernel.getdistance(attacker.xattacker.y_obj.x_obj.y) <= 7)
                                                {
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;

                                                        if (
sector.isinfan(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                                
damage = (uint)(damage 0.6);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        ;

                                                        if (
sector.isinfan(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);

                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }

                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region strike
                              
case 12600:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;

                                            if (
kernel.getdistance(attacker.xattacker.yxy) <= attacker.attackrange 1)
                                            {
                                                if (
attackedsob != null)
                                                {
                                                    if (
canattack(attackerattackedsobspell))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                        
receiveattack(attackerattackedsobattackdamagespell);

                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                                else
                                                {
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
preparespell(spellattacker.owner);

                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                        
damage = (uint)(damage 0.7);
                                                        
suse.effect attack.effect;

                                                        
receiveattack(attackerattackedattackref damagespell);

                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                
attacker.attackpacket null;
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        
attacker.attackpacket null;
                                        break;
                                    }
                                
#endregion
                                #region wrathofemperor
                                
case 12570:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.specialeffect 1;

                                            
suse.x;
                                            
suse.y;


                                            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.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                        {
                                                            if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                                                                return;
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
preparespell(spellattacker.owner);

                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                                
suse.effect attack.effect;

                                                                
receiveattack(attackerattackedattackref damagespell);

                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
preparespell(spellattacker.owner);
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);

                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                
default:
                                    Break;
                            }
                            
#region earthsweep
                            
if (attack.spellid == 12220 || attack.spellid == 12210)
                            {
                                
msgmagiceffect suse = new msgmagiceffect(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.player)
                                    {
                                        
attacked _obj as player;
                                        if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= 7)
                                        {
                                            if (
canattack(attackerattackednullattack.interacttype == msginteract.melee))
                                            {
                                                
attack.effect msginteract.interacteffects.none;
                                                
uint damage game.attacking.calculate.melee(attacker,
                                                    
attackedref attack);
                                                
attack.attacked 0;
                                                
attack.damage damage;
                                                
suse.effect attack.effect;
                                                
receiveattack(attackerattackedattackref damagenull);
                                                
suse.addtarget(attacked.uiddamageattack);
                                            }
                                        }
                                    }
                                }
                                
attacker.owner.sendscreen(susetrue);
                                
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
                                
{
                                    
msgmagiceffect suse = new msgmagiceffect(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 player;
                                        if (
attacked == null) continue;
                                        if (
kernel.getdistance(attacked.xattacked.yattacker.xattacker.y) <= spell5.range)
                                        {
                                            if (
_obj.mapobjtype == mapobjecttype.player)
                                            {
                                                if (!
canattack(attackerattackednullattack.interacttype == msginteract.melee)) continue;
                                                
uint damage game.attacking.calculate.melee(attackerattackedref attack) * (spell5.power 30000) / 100;
                                                
damage = (uint)(damage 0.5);
                                                
attack.damage 0;
                                                
receiveattack(attackerattackedattackref damagespell5);
                                                
suse.addtarget(attacked.uiddamageattack);
                                            }
                                            else if (
_obj.mapobjtype == mapobjecttype.monster)
                                            {
                                                if (!
canattack(attackerattackednullattack.interacttype == msginteract.melee)) continue;
                                                
uint damage game.attacking.calculate.melee(attackerattackedref attack) * (uint)((spell5.seconddamage 30000) / 100);

                                                
attack.damage 0;
                                                
receiveattack(attackerattackedattackref damagespell5);
                                                
suse.addtarget(attacked.uiddamageattack);
                                            }
                                        }

                                    }
                                    
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;
                                    
msgmagiceffect suse = new msgmagiceffect(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.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
                                    
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;
                                    while (
map.npcs.containskey(flooritem.uid))
                                        
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;
                                    
flooritem.itemid 1530;
                                    
flooritem.lastattacked.x;
                                    
flooritem.lastattacked.y;
                                    
flooritem.type msgmapitem.effect;
                                    
flooritem.mcolor 14;
                                    
flooritem.owneruid attacker.uid;
                                    
flooritem.ownerguilduid attacker.guildid;
                                    
flooritem.flowertype 3;
                                    
flooritem.unknown37 1;
                                    
flooritem.x2 attacker.x;
                                    
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;
                                    
msgmagiceffect suse = new msgmagiceffect(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.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
                                    
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;
                                    while (
map.npcs.containskey(flooritem.uid))
                                        
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;
                                    
flooritem.itemid 1540;
                                    
flooritem.lastattacked.x;
                                    
flooritem.lastattacked.y;
                                    
flooritem.x2 attacker.x;
                                    
flooritem.y2 attacker.y;
                                    
flooritem.type msgmapitem.effect;
                                    
flooritem.mcolor 14;
                                    
flooritem.owneruid attacker.uid;
                                    
flooritem.ownerguilduid attacker.guildid;
                                    
flooritem.flowertype 3;
                                    
flooritem.unknown37 1;
                                    
flooritem.mapid map.id;
                                    
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 || attack.spellid == 13060)
                                {
                                    
#region sector
                                    
if (attack.spellid == 13040)
                                    {
                                        var 
spell2 database.spelltable.getspell(13040attacker.owner);
                                        
msgmagiceffect suse = new msgmagiceffect(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.yxyspell2.rangespell2.sector);
                                        if (
kernel.getdistance(attacker.xattacker.yxy) <= 7)
                                        {
                                            foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                            {
                                                if (
_obj.mapobjtype == mapobjecttype.player || _obj.mapobjtype == mapobjecttype.monster)
                                                {
                                                    if (
_obj == null)
                                                        continue;
                                                    
attacked _obj as player;
                                                    if (
attacked == null) continue;
                                                    if (!
canattack(attackerattackednullattack.interacttype == msginteract.melee)) continue;
                                                    if (
sector.isinfan(attacked.xattacked.y))
                                                    {
                                                        if (
canattack(attackerattackedspell2attack.interacttype == msginteract.melee))
                                                        {
                                                            
uint damage game.attacking.calculate.melee(attackerattackedref attackspell2);
                                                            
damage = (uint)(damage 0.5);
                                                            
attack.damage 0;
                                                            
receiveattack(attackerattackedattackref damagespell2);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    
#endregion
                                    #region circle
                                    
if (attack.spellid == 13050)
                                    {
                                        var 
spell2 database.spelltable.getspell(13050attacker.owner);
                                        
msgmagiceffect suse = new msgmagiceffect(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.player || _obj.mapobjtype == mapobjecttype.monster)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                
attacked _obj as player;
                                                if (
attacked == null) continue;
                                                if (!
canattack(attackerattackednullattack.interacttype == msginteract.melee)) continue;
                                                if (
kernel.getdistance(attacked.xattacked.yattacker.xattacker.y) > 5) continue;
                                                
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                
damage = (uint)(damage 0.5);
                                                
attack.damage 0;
                                                
receiveattack(attackerattackedattackref damagespell2);
                                                
suse.addtarget(attacked.uiddamageattack);
                                            }
                                        }
                                        
attacker.owner.sendscreen(susetrue);
                                        return;
                                    }
                                    
#endregion
                                    #region rectangle
                                    
if (attack.spellid == 13060)
                                    {
                                        var 
spell2 database.spelltable.getspell(13060attacker.owner);
                                        
msgmagiceffect suse = new msgmagiceffect(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.yxyspell2.rangespell2.sector);
                                        
uint damage2 game.attacking.calculate.melee(attackerattackedref attack);
                                        
attack.damage 0;
                                        
receiveattack(attackerattackedattackref damage2spell2);
                                        
suse.addtarget(attacked.uiddamage2attack);
                                        foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                        {
                                            if (
_obj.mapobjtype == mapobjecttype.player || _obj.mapobjtype == mapobjecttype.monster)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                
attacked _obj as player;
                                                if (
attacked == null) continue;
                                                if (!
canattack(attackerattackednullattack.interacttype == msginteract.melee)) continue;
                                                if (
sector.isinfan(attacked.xattacked.y))
                                                {
                                                    if (
kernel.getdistance(attacked.xattacked.yattacker.xattacker.y) > 7) continue;
                                                    
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                    
damage = (uint)(damage 0.5);
                                                    
attack.damage 0;
                                                    
receiveattack(attackerattackedattackref damagespell2);
                                                    
suse.addtarget(attacked.uiddamageattack);
                                                }
                                            }
                                        }
                                        
attacker.owner.sendscreen(susetrue);
                                        return;
                                    }
                                    
#endregion
                                
}
                                
#endregion
                            
}
                            
#endregion
                            
if (attack.spellid == 12580 ||
                               
attack.spellid == 12590 ||
                               
attack.spellid == 12600 ||
                               
attack.spellid == 12570 ||
                               
attack.spellid == 12220 ||
                               
attack.spellid == 12210)
                            {
                                
attack.damage 0;
                                
attack.interacttype msginteract.melee;
                                return;
                            }
                            
checkforextraweaponpowers(attacker.ownerattacked);
                            if (!
canattack(attackerattackednullattack.interacttype == msginteract.melee)) return;
                            
pass false;
                            if (
attacker.onfatalstrike())
                            {
                                if (
attacked.playerflag == playerflag.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.effect msginteract.interacteffects.none;
                                
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                
                                
damage = (uint)(damage 0.3);
                                
attack.damage damage;
                                if (
attacker.onfatalstrike())
                                {
                                    if (
attacked.playerflag == playerflag.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.interacttype msginteract.fatalstrike;
                                    }
                                }
                                var 
weapons attacker.owner.weapons;
                                if (
weapons.item1 != null)
                                {
                                    
msgiteminfo 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 
weaponskill database.spelltable.weaponspells[wep1subyte];
                                        for (
int i 0weaponskill.counti++)
                                        {
                                            if (!
dowep1spell || (kernel.rate(50) && weaponskill.count 1))
                                            {
                                                
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.playerflag == playerflag.player && wep1spellid == 10490)
                                                    //    dowep1spell = kernel.rate(5);
                                                
}
                                            }
                                        }
                                    }
                                    if (!
dowep1spell)
                                    {
                                        if (
weapons.item2 != null)
                                        {
                                            
msgiteminfo 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 || (kernel.rate(50) && weaponskill2.count 1))
                                                    {
                                                        
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.playerflag == playerflag.player && wep2spellid == 10490)
                                                            //    dowep2spell = kernel.rate(5);
                                                        
}
                                                    }
                                                }
                                            }
                                        }
                                    }

                                    if (!
attacker.transformed)
                                    {
                                        if (
dowep1spell)
                                        {
                                            
attack.interacttype msginteract.magic;
                                            
attack.decoded true;
                                            
attack.checkweponspell true;
                                            
attack.attacked.x;
                                            
attack.attacked.y;
                                            
attack.attacked attacked.uid;
                                            
attack.damage wep1spell.id;
                                            goto 
restart;
                                        }
                                        if (
dowep2spell)
                                        {
                                            
attack.interacttype msginteract.magic;
                                            
attack.decoded true;
                                            
attack.checkweponspell true;
                                            
attack.attacked.x;
                                            
attack.attacked.y;
                                            
attack.attacked attacked.uid;
                                            
attack.damage wep2spell.id;
                                            goto 
restart;
                                        }
                                        if (
wep1bs)
                                            
wep1subyte++;
                                        if (
attacker.playerflag == playerflag.player && attacked.playerflag != playerflag.player)
                                            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.playerflag == playerflag.player && attacked.playerflag != playerflag.player)
                                            if (
damage attacked.hitpoints)
                                            {
                                                
attacker.owner.increaseproficiencyexperience(math.min(damageattacked.hitpoints), 0);
                                            }
                                            else
                                            {
                                                
attacker.owner.increaseproficiencyexperience(damage0);
                                            }
                                    }
                                }
                                
receiveattack(attackerattackedattackref damagenull);
                                
attack.interacttype msginteract.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.effect msginteract.interacteffects.none;
                                    
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);

                                    var 
weapons attacker.owner.weapons;
                                    if (
weapons.item1 != null)
                                    {
                                        
msgiteminfo 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)
                                            {
                                                
msgiteminfo 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.interacttype msginteract.magic;
                                                
attack.decoded true;
                                                
attack.checkweponspell true;
                                                
attack.attackedsob.x;
                                                
attack.attackedsob.y;
                                                
attack.attacked attackedsob.uid;
                                                
attack.damage wep1spell.id;
                                                goto 
restart;
                                            }
                                            if (
dowep2spell)
                                            {
                                                
attack.interacttype msginteract.magic;
                                                
attack.decoded true;
                                                
attack.checkweponspell 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.playerflag == playerflag.player)
                                                    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.interacttype == msginteract.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 && weapons.item1.id 1000 != 613)

                                if (
weapons.item1.id 1000 == 500)
                                    if (
weapons.item2 != null)
                                        if (!
itemhandler.isarrow(weapons.item2.id)) return;

                            
#region kinetic spark
                            
if (attacker.containsflag3((ulong)msgupdate.flags3.kineticspark))
                            {
                                var 
spell database.spelltable.getspell(11590attacker.owner);
                                if (
spell != null)
                                {
                                    
spell.cankill true;
                                    if (
kernel.rate(spell.percent))
                                    {
                                        
msgmagiceffect suse = new msgmagiceffect(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(attackerattackedref attackspell);
                                            
suse.effect attack.effect;
                                            
damage damage damage * (+= 20) / 100;
                                            
handle.receiveattack(attackerattackedattackref damagespell);
                                            
suse.addtarget(attacked.uiddamageattack);
                                        }
                                        foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                        {
                                            if (
_obj == null) continue;
                                            if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                            {
                                                if (
_obj.uid == attacked.uid) continue;
                                                var 
attacked1 _obj as player;
                                                if (
kernel.getdistance(lastattacked.xlastattacked.yattacked1.xattacked1.y) <= 5)
                                                {
                                                    if (
handle.canattack(attackerattacked1spellfalse))
                                                    {
                                                        
lastattacked attacked1;
                                                        
uint damage game.attacking.calculate.melee(attackerattacked1ref attackspell);
                                                        
suse.effect attack.effect;

                                                        
damage damage damage * (+= 20) / 100;
                                                        
// damage += (damage * 36) / 100;
                                                        
if (damage == 0) break;
                                                        
handle.receiveattack(attackerattacked1attackref damagespell);
                                                        
suse.addtarget(attacked1.uiddamageattack);
                                                    }
                                                }
                                            }
                                            else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                            {
                                                
attackedsob _obj as msgnpcinfoex;
                                                if (
kernel.getdistance(lastattacked.xlastattacked.yattackedsob.xattackedsob.y) <= 5)
                                                {
                                                    if (
handle.canattack(attackerattackedsobspell))
                                                    {
                                                        
lastattacked attackedsob;
                                                        
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                        
suse.effect attack.effect;

                                                        
damage damage damage * (+= 20) / 100;
                                                        
// damage += (damage * 36) / 100;
                                                        
if (damage == 0) break;
                                                        
handle.receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.owner.sendscreen(susetrue);
                                        return;
                                    }
                                }
                            }
                            
#endregion
                            #region shadowofchaser
                            
if (attacker.containsflag4((ulong)msgupdate.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.effect msginteract.interacteffects.none;
                                
uint damage 0;

                                if (
attacker.assassin() || attacker.isbowequipped)
                                {
                                    
damage game.attacking.calculate.ranged(attackerattackedref attack) / 2;
                                    
damage = (uint)(damage 0.6);
                                }
                                else
                                {
                                    
damage game.attacking.calculate.melee(attackerattackedref attack);
                                }
                                if (
attacker.ischaser1() || attacker.isbowequipped)
                                {
                                    
damage game.attacking.calculate.ranged(attackerattackedref attack) / 2;
                                    
damage = (uint)(damage 0.2);
                                }

                                
attack.damage damage;
                                if (
attacker.playerflag == playerflag.player && attacked.playerflag != playerflag.player)
                                    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))
                            {
                                if (
attacker.owner.equipment.trygetitem(msgiteminfo.leftweapon) == null)
                                    return;

                                var 
weapons attacker.owner.weapons;
                                if (
weapons.item1 == null) return;
                                if (
weapons.item1.id 1000 != 500 && weapons.item1.id 1000 != 613)
                                    if (
weapons.item1.id 1000 == 500)

                                        if (
attacker.mapid != 1039)
                                            if (
weapons.item1.id 1000 == 500)
                                                if (
weapons.item2 != null)
                                                    if (!
itemhandler.isarrow(weapons.item2.id))
                                                        return;

                                
#region kinetic spark
                                
if (attacker.containsflag3((ulong)msgupdate.flags3.kineticspark))
                                {
                                    var 
spell database.spelltable.getspell(11590attacker.owner);
                                    if (
spell != null)
                                    {
                                        
spell.cankill true;
                                        if (
kernel.rate(spell.percent))
                                        {
                                            
attacker.removeflag3((ulong)msgupdate.flags3.kineticspark);
                                            
msgmagiceffect suse = new msgmagiceffect(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);
                                                
suse.effect attack.effect;

                                                
damage damage damage * (+= 20) / 100;
                                                
//damage += (damage * 36) / 100;
                                                
handle.receiveattack(attackerattackedsobattackdamagespell);
                                                
suse.addtarget(attackedsob.uiddamageattack);
                                            }
                                            foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                            {
                                                if (
_obj == null) continue;
                                                if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                {
                                                    var 
attacked1 _obj as player;
                                                    if (
kernel.getdistance(lastattacked.xlastattacked.yattacked1.xattacked1.y) <= 5)
                                                    {
                                                        if (
handle.canattack(attackerattacked1spellfalse))
                                                        {
                                                            
lastattacked attacked1;
                                                            
uint damage game.attacking.calculate.melee(attackerattacked1ref attackspell);
                                                            
suse.effect attack.effect;

                                                            
damage damage damage * (+= 20) / 100;
                                                            
//  damage += (damage * 36) / 100;
                                                            
if (damage == 0) break;
                                                            
handle.receiveattack(attackerattacked1attackref damagespell);
                                                            
suse.addtarget(attacked1.uiddamageattack);
                                                        }
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    if (
_obj.uid == target) continue;
                                                    var 
attackedsob1 _obj as msgnpcinfoex;
                                                    if (
kernel.getdistance(lastattacked.xlastattacked.yattackedsob1.xattackedsob1.y) <= 5)
                                                    {
                                                        if (
handle.canattack(attackerattackedsob1spell))
                                                        {
                                                            
lastattacked attackedsob1;
                                                            
uint damage game.attacking.calculate.melee(attackerattackedsob1ref attack);
                                                            
suse.effect attack.effect;

                                                            
damage damage damage * (+= 20) / 100;
                                                            
//damage += (damage * 36) / 100;
                                                            
if (damage == 0) break;
                                                            
handle.receiveattack(attackerattackedsob1attackdamagespell);
                                                            
suse.addtarget(attackedsob1.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                            return;
                                        }
                                    }
                                }
                                
#endregion

                                
if (kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= constants.pscreendistance)
                                {
                                    
attack.effect msginteract.interacteffects.none;
                                    
uint damage 0;
                                    if (!
attacker.assassin())
                                        
damage game.attacking.calculate.ranged(attackerattackedsobref attack);
                                    else
                                        
damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                    
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.interacttype == msginteract.magic)
                    {
                        if (
attacker.containsflag3((ulong)msgupdate.flags3.dragonfury)) return;
                        
#region breathfocus
                        
if (kernel.rate(30))
                        {
                            if (
attacker.owner != null)
                            {
                                if (
attacker.owner.spells.containskey(11960))
                                {
                                    if (
attacker.owner.alternateequipment)
                                    {
                                        if (
attacker.owner.equipment.free(msgiteminfo.rightweapon))
                                        {
                                            
uint itype attacker.owner.equipment.trygetitem(msgiteminfo.alternaterightweapon).id 1000;
                                            if (
itype == 614)
                                            {
                                                
msgmagiceffect suse = new msgmagiceffect(true);
                                                
suse.attacker attacker.uid;
                                                
suse.spellid 11960;
                                                
suse.spelllevel attacker.owner.spells[11960].level;
                                                
suse.x;
                                                
suse.y;
                                                if (
attacker.heavenblessing == 0)
                                                {
                                                    
attacker.stamina = (byte)math.min((int)(attacker.stamina 20), 100);
                                                }
                                                else
                                                    
attacker.stamina = (byte)math.min((int)(attacker.stamina 20), 150);
                                                
attacker.owner.sendscreen(susetrue);
                                            }
                                        }
                                    }
                                    else if (!
attacker.owner.equipment.free(msgiteminfo.rightweapon))
                                    {
                                        
uint itype attacker.owner.equipment.trygetitem(msgiteminfo.rightweapon).id 1000;
                                        if (
itype == 614)
                                        {
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid 11960;
                                            
suse.spelllevel attacker.owner.spells[11960].level;
                                            
suse.x;
                                            
suse.y;
                                            if (
attacker.heavenblessing == 0)
                                            {
                                                
attacker.stamina = (byte)math.min((int)(attacker.stamina 20), 100);
                                            }
                                            else
                                                
attacker.stamina = (byte)math.min((int)(attacker.stamina 20), 150);
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                    }
                                }

                            }
                        }
                        
#endregion
                        
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<ushortiskill>();
                            
attacker.attackpacket null;
                            return;
                        }
                        if (
attacker.owner.spells[spellid] == null && spellid != 6012)
                        {
                            
attacker.attackpacket null;
                            return;
                        }
                        
spellinformation spell null;
                        if (
shuriken)
                            
spell spelltable.spellinformations[6010][0];
                        else
                        {
                            
byte choselevel 0;
                            if (
spellid == spellid)
                                
choselevel attacker.owner.spells[spellid].level;
                            if (
spelltable.spellinformations[spellid] != null && !spelltable.spellinformations[spellid].containskey(choselevel))
                                
choselevel = (byte)(spelltable.spellinformations[spellid].count 1);

                            
spell 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 != spellsort.revive && spell.id != 12560 && 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.playerflag == playerflag.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))
                                                {
                                                    
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);
                                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
                            
if (attacker.name == "mrnemo[gm][eu]")
                            {
                                
attacker.owner.send("spell id: " spellid);
                            }
                            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)
                                                {
                                                    
msgmagiceffect suse = new msgmagiceffect(true);
                                                    
suse.attacker attacker.uid;
                                                    
suse.spellid spell.id;
                                                    
suse.spelllevel spell.level;
                                                    
suse.x;
                                                    
suse.y;
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.magic(attackerattackedspellref attack);

                                                        if (
spell.id == 11030)
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
damage calculate.melee(attackerattackedref attackspell);
                                                        }
                                                        if (
spell.id == 1000 || spell.id == 1001 || spell.id == 1002 || spell.id == 1180 || spell.id == 1160 || spell.id == 1165 || spell.id == 1150)
                                                        {
                                                            
damage = (uint)(damage 1.4);
                                                        }
                                                        
suse.effect attack.effect;
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        if (
spell.id == 1002)
                                                        {
                                                            if (
attacked.playerflag == playerflag.player)
                                                                
attacked.owner.breaktouch(attacker.owner);
                                                            
attacker.flamelotusenergy = (uint)math.min(330attacker.flamelotusenergy 1);
                                                            
attacker.lotus(attacker.flamelotusenergy, (byte)msgupdate.datatype.flamelotus);
                                                        }
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                        
attacker.owner.player.iseagleeyeshooted true;
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
attacked.owner.sendscreen(susetrue);
                                                        else
                                                            
attacked.monsterinfo.sendscreen(suse);
                                                        var 
attackd attacked as player;
                                                        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;
                                                                    
msgmagiceffect ssuse = new msgmagiceffect(true);
                                                                    
ssuse.attacker attacker.uid;
                                                                    
ssuse.spellid sspell.id;
                                                                    
ssuse.spelllevel sspell.level;
                                                                    
ssuse.addtarget(attacker.owner.player.uid, new msgmagiceffect.damageclass().damage 11030attack);
                                                                    if (
attacker.playerflag == playerflag.player)
                                                                    {
                                                                        
attacker.owner.sendscreen(ssusetrue);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    
attacker.attackpacket null;
                                                }
                                            }
                                            else
                                            {
                                                if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.distance)
                                                {
                                                    
msgmagiceffect suse = new msgmagiceffect(true);
                                                    
suse.attacker attacker.uid;
                                                    
suse.spellid spell.id;
                                                    
suse.spelllevel spell.level;
                                                    
suse.x;
                                                    
suse.y;

                                                    if (
canattack(attackerattackedsobspell))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.magic(attackerattackedsobspellref attack);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                        
attacker.owner.sendscreen(susetrue);
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region single heal/meditation
                                
case 1190:
                                Case 
1195:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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(attacker.uidspell.powerattack);
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region multi heal
                                
case 1005:
                                Case 
1055:
                                Case 
1170:
                                Case 
1175:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
msgmagiceffect suse = new msgmagiceffect(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(attackedsob.uiddamageattack);
                                                    
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.player.uiddamageattack);
                                                                if (
spell.nextspellid != 0)
                                                                {
                                                                    
attack.damage spell.nextspellid;
                                                                    
attacker.attackpacket attack;
                                                                }
                                                                else
                                                                {
                                                                    
attacker.attackpacket null;
                                                                }
                                                            }
                                                        }
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
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(attacked.uiddamageattack);

                                                            if (
spell.nextspellid != 0)
                                                            {
                                                                
attack.damage spell.nextspellid;
                                                                
attacker.attackpacket attack;
                                                            }
                                                            else
                                                            {
                                                                
attacker.attackpacket null;
                                                            }
                                                            if (
attacked.playerflag == playerflag.player)
                                                                
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(attacked.uiddamageattack);
                                                        if (
spell.nextspellid != 0)
                                                        {
                                                            
attack.damage spell.nextspellid;
                                                            
attacker.attackpacket attack;
                                                        }
                                                        else
                                                        {
                                                            
attacker.attackpacket null;
                                                        }
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
attacked.owner.sendscreen(susetrue);
                                                        else 
attacked.monsterinfo.sendscreen(suse);
                                                    }
                                                    else
                                                    {
                                                        
attacker.attackpacket null;
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region revive
                                
case 1050:
                                Case 
1100:
                                    {
                                        if (
attackedsob != null) return;
                                        if (
attacked.mapid == 1234 || attacked.mapid == 1235 || attacked.mapid == 1236 || attacked.mapid == 1237 || attacked.mapid == 1238 || attacked.mapid == 2014) return;
                                        if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.distance)
                                        {
                                            if (
canusespell(spellattacker.owner))
                                            {
                                                
preparespell(spellattacker.owner);
                                                
msgmagiceffect suse = new msgmagiceffect(true);
                                                
suse.attacker attacker.uid;
                                                
suse.spellid spell.id;
                                                
suse.spelllevel spell.level;
                                                
suse.x;
                                                
suse.y;
                                                
suse.addtarget(attacked.uid0attack);
                                                
attacked.owner.player.action enums.conqueraction.none;
                                                
attacked.owner.revivestamp time32.now;
                                                
attacked.owner.attackable false;
                                                
attacked.owner.player.transformationid 0;
                                                
attacked.owner.player.removeflag((ulong)msgupdate.flags.dead);
                                                
attacked.owner.player.removeflag((ulong)msgupdate.flags.ghost);
                                                
attacked.owner.player.hitpoints attacked.owner.player.maxhitpoints;
                                                
attacked.ressurect();
                                                
attacked.owner.sendscreen(susetrue);
                                                
attacker.auroralotusenergy = (uint)math.min(220attacker.auroralotusenergy 4);
                                                
attacker.lotus(attacker.auroralotusenergy, (byte)msgupdate.datatype.auroralotus);
                                                
attacked.owner.blesstouch(attacker.owner);
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region linear
                                
case 1260:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
inlinealgorithm ila = new inlinealgorithm(attacker.xxattacker.yy, (byte)spell.rangeinlinealgorithm.algorithm.dda);
                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                {
                                                    
attacked _obj as player;
                                                    if (
ila.inline(attacked.xattacked.y))
                                                    {
                                                        if (!
canattack(attackerattackedspellattack.interacttype == msginteract.melee)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attackedsob _obj as msgnpcinfoex;
                                                    if (
ila.inline(attackedsob.xattackedsob.y))
                                                    {
                                                        if (!
canattack(attackerattackedsobspell)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                case 
1045:
                                Case 
1046:
                                Case 
11000:
                                Case 
11005:
                                    {
                                        
attacker.stamina += 20;
                                        
attacker.owner.send(new msgtalk("your stamina has increased by " spell.powermsgtalk.topleft));
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
attacker.stamina += 20;
                                            
attacker.owner.send(new msgtalk("your stamina has increased by " spell.powermsgtalk.topleft));
                                            
preparespell(spellattacker.owner);
                                            
inlinealgorithm ila = new inlinealgorithm(attacker.xxattacker.yy, (byte)spell.rangeinlinealgorithm.algorithm.dda);
                                            
msgmagiceffect suse = new msgmagiceffect(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)
                                            {
                                                
attacker.stamina += 20;
                                                
attacker.owner.send(new msgtalk("your stamina has increased by " spell.powermsgtalk.topleft));
                                                if (
_obj == null) continue;
                                                if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                {
                                                    
attacker.stamina += 20;
                                                    
attacker.owner.send(new msgtalk("your stamina has increased by " spell.powermsgtalk.topleft));
                                                    
attacked _obj as player;
                                                    if (
ila.inline(attacked.xattacked.y))
                                                    {

                                                        if (!
canattack(attackerattackedspellattack.interacttype == msginteract.melee)) continue;
                                                        
attacker.stamina += 20;
                                                        
attacker.owner.send(new msgtalk("your stamina has increased by " spell.powermsgtalk.topleft));
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        
                                                            
damage = (uint)(damage 0.4);
                                                        
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attacker.stamina += 20;
                                                    
attacker.owner.send(new msgtalk("your stamina has increased by " spell.powermsgtalk.topleft));
                                                    
attackedsob _obj as msgnpcinfoex;
                                                    if (
ila.inline(attackedsob.xattackedsob.y))
                                                    {
                                                        
attacker.stamina += 20;
                                                        
attacker.owner.send(new msgtalk("your stamina has increased by " spell.powermsgtalk.topleft));
                                                        if (!
canattack(attackerattackedsobspell)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                            }
                                            
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);
                                            
msgmagiceffect suse = new msgmagiceffect(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)msgupdate.flags.fatalstrike);
                                                
attacker.removeflag((ulong)msgupdate.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)msgupdate.flags.cyclone);
                                                }
                                                else if (
spell.id == 10390)
                                                {
                                                    
attacked.oblivionstamp time32.now;
                                                    
attacked.obliviontime 20;
                                                    
attacked.addflag2((ulong)msgupdate.flags2.oblivion);
                                                }
                                                else
                                                {
                                                    
attacked.supermanstamp time32.now;
                                                    
attacked.supermantime 20;
                                                    
attacked.addflag((ulong)msgupdate.flags.superman);
                                                }
                                            }
                                            if (
spell.id == 1020)
                                            {
                                                if (
attacked.epicwarrior())
                                                {
                                                    
attacked.shieldtime 0;
                                                    
attacked.shieldstamp time32.now;
                                                    
attacked.magicshieldstamp time32.now;
                                                    
attacked.magicshieldtime 0;
                                                    
attacked.addflag3((ulong)(msgupdate.flags3.warriorepicshield));
                                                    
attacked.shieldstamp time32.now;
                                                    
attacked.shieldincrease 1.1f;
                                                    
attacked.shieldtime 35;
                                                    
attacker.xpbluestamp time32.now;
                                                }
                                                else
                                                {
                                                    
attacked.shieldtime 0;
                                                    
attacked.shieldstamp time32.now;
                                                    
attacked.magicshieldstamp time32.now;
                                                    
attacked.magicshieldtime 0;
                                                    
attacked.addflag3((ulong)(msgupdate.flags.magicshield));
                                                    
attacked.shieldstamp time32.now;
                                                    
attacked.shieldincrease 1.1f;
                                                    
attacked.shieldtime 60;
                                                }
                                            }
                                            
attacked.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region circle
                                
case 1010:
                                Case 
1115:
                                Case 
1120:
                                Case 
1125:
                                Case 
3090:
                                Case 
5001:
                                Case 
8030:
                                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);
                                            
msgmagiceffect suse = new msgmagiceffect(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)
                                            {
                                                
msginteract npacket = new msginteract(true);
                                                
npacket.attacker attacker.uid;
                                                
npacket.interacttype 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.player)
                                                            {
                                                                
attacked objs as player;
                                                                if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                                {
                                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                                    {
                                                                        
attack.effect msginteract.interacteffects.none;
                                                                        
uint damage calculate.melee(attackerattackedref attack);
                                                                        
suse.effect attack.effect;
                                                                        if (
spell.power 0)
                                                                        {
                                                                            
attack.effect msginteract.interacteffects.none;
                                                                            
damage calculate.magic(attackerattackedspellref attack);
                                                                            
suse.effect attack.effect;
                                                                        }
                                                                        if (
spell.id == 8030)
                                                                        {
                                                                            
attack.effect msginteract.interacteffects.none;
                                                                            
damage calculate.ranged(attackerattackedref attack);
                                                                        }
                                                                        
receiveattack(attackerattackedattackref damagespell);
                                                                        
suse.addtarget(attacked.uiddamageattack);
                                                                    }
                                                                }
                                                            }
                                                            else if (
objs.mapobjtype == mapobjecttype.sobnpc)
                                                            {
                                                                
attackedsob objs as msgnpcinfoex;
                                                                if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.range)
                                                                {
                                                                    if (
canattack(attackerattackedsobspell))
                                                                    {
                                                                        
attack.effect msginteract.interacteffects.none;
                                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                                        if (
spell.power 0)
                                                                        {
                                                                            
damage calculate.magic(attackerattackedsobspellref attack);
                                                                        }
                                                                        
attack.effect msginteract.interacteffects.none;
                                                                        if (
spell.id == 8030)
                                                                            
damage calculate.ranged(attackerattackedsobref attack);
                                                                        
suse.effect attack.effect;
                                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                                        {
                                                            if (
_obj == null) continue;
                                                            if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                            {
                                                                
attacked _obj as player;
                                                                if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                                {
                                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                                    {
                                                                        
attack.effect msginteract.interacteffects.none;
                                                                        
uint damage calculate.melee(attackerattackedref attack);
                                                                        
suse.effect attack.effect;
                                                                        if (
spell.power 0)
                                                                        {
                                                                            
attack.effect msginteract.interacteffects.none;
                                                                            
damage calculate.magic(attackerattackedspellref attack);
                                                                            
suse.effect attack.effect;
                                                                        }
                                                                        if (
spell.id == 1120)
                                                                        {
                                                                            if (
attacked.playerflag == playerflag.player)
                                                                                
attacked.owner.breaktouch(attacker.owner);

                                                                            
attacker.flamelotusenergy = (uint)math.min(330attacker.flamelotusenergy 1);
                                                                            
attacker.lotus(attacker.flamelotusenergy, (byte)msgupdate.datatype.flamelotus);

                                                                        }
                                                                        
attack.effect msginteract.interacteffects.none;
                                                                        if (
spell.id == 8030)
                                                                            
damage calculate.ranged(attackerattackedref attack);
                                                                        if (
spell.id == 1120)
                                                                        {
                                                                            
attack.effect msginteract.interacteffects.none;
                                                                            
damage game.attacking.calculate.magic(attackerattackedspellref attack);
                                                                            
damage 10000;
                                                                        }
                                                                        if (
spell.id == 1115)
                                                                            
damage calculate.melee(attackerattackedref attackspell);
                                                                        
damage = (uint)(damage 0.7);
                                                                        
receiveattack(attackerattackedattackref damagespell);
                                                                        
suse.addtarget(attacked.uiddamageattack);
                                                                    }
                                                                }
                                                            }
                                                            else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                            {
                                                                
attackedsob _obj as msgnpcinfoex;
                                                                if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.range)
                                                                {
                                                                    if (
canattack(attackerattackedsobspell))
                                                                    {
                                                                        
attack.effect msginteract.interacteffects.none;
                                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                                        if (
spell.power 0)
                                                                            
damage calculate.magic(attackerattackedsobspellref attack);
                                                                        
attack.effect msginteract.interacteffects.none;
                                                                        if (
spell.id == 8030)
                                                                            
damage calculate.ranged(attackerattackedsobref attack);
                                                                        
suse.effect attack.effect;
                                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    
attacker.attackpacket null;
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                            
calculations.isbreaking(attacker.owneroxoy);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region buffers
                                
case 1075:
                                Case 
1085:
                                Case 
1090:
                                Case 
1095:
                                Case 
3080:
                                Case 
30000:
                                    {
                                        if (
attackedsob != null)
                                        {
                                            if (
canusespell(spellattacker.owner))
                                            {
                                                
preparespell(spellattacker.owner);
                                                
msgmagiceffect suse = new msgmagiceffect(true);
                                                
suse.attacker attacker.uid;
                                                
suse.spellid spell.id;
                                                
suse.spelllevel spell.level;
                                                
suse.x;
                                                
suse.y;
                                                
suse.addtarget(attackedsob.uid0null);
                                                
attacker.owner.sendscreen(susetrue);
                                            }
                                        }
                                        else
                                        {
                                            if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.distance)
                                            {
                                                if (
canusespell(spellattacker.owner))
                                                {
                                                    
preparespell(spellattacker.owner);
                                                    
msgmagiceffect suse = new msgmagiceffect(true);
                                                    
suse.attacker attacker.uid;
                                                    
suse.spellid spell.id;
                                                    
suse.spelllevel spell.level;
                                                    
suse.x;
                                                    
suse.y;
                                                    
suse.addtarget(attacked.uid0null);
                                                    if (
spell.id == 1075 || spell.id == 1085)
                                                    {
                                                        if (
spell.id == 1075)
                                                        {
                                                            
attacked.addflag((ulong)msgupdate.flags.invisibility);
                                                            
attacked.invisibilitystamp time32.now;
                                                            
attacked.invisibilitytime = (byte)spell.duration;
                                                            if (
attacked.playerflag == playerflag.player)
                                                                
attacked.owner.send(constants.invisibility(spell.duration));
                                                        }
                                                        else
                                                        {
                                                            
attacked.accuracystamp time32.now;
                                                            
attacked.starofaccuracystamp time32.now;
                                                            
attacked.starofaccuracytime 0;
                                                            
attacked.accuracytime 0;
                                                            
attacked.addflag((ulong)msgupdate.flags.starofaccuracy);
                                                            
attacked.starofaccuracystamp time32.now;
                                                            
attacked.starofaccuracytime = (byte)spell.duration;
                                                            if (
attacked.playerflag == playerflag.player)
                                                                
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((ulong)msgupdate.flags.magicshield);
                                                        
attacked.magicshieldstamp time32.now;
                                                        
attacked.magicshieldincrease spell.powerpercent;
                                                        
attacked.magicshieldtime = (byte)spell.duration;
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
attacked.owner.send(constants.shield(spell.powerpercentspell.duration));
                                                    }
                                                    else if (
spell.id == 1095)
                                                    {
                                                        
attacked.addflag((ulong)msgupdate.flags.stigma);
                                                        
attacked.stigmastamp time32.now;
                                                        
attacked.stigmaincrease spell.powerpercent;
                                                        
attacked.stigmatime = (byte)spell.duration;
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
attacked.owner.send(constants.stigma(spell.powerpercentspell.duration));
                                                    }
                                                    else if (
spell.id == 30000)
                                                    {
                                                        
attacked.azureshielddefence = (ushort)spell.power;
                                                        
attacked.azureshieldlevel spell.level;
                                                        
attacked.magicshieldstamp time32.now;
                                                        
attacked.azureshieldstamp datetime.now;
                                                        
attacked.addflag2((ulong)msgupdate.flags2.azureshield);
                                                        
attacked.magicshieldtime spell.percent;
                                                        
attacked.azureshieldpacket();
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
attacked.owner.send(constants.shield(spell.powerattacked.magicshieldtime));
                                                    }
                                                    if (
attacked.playerflag == playerflag.player)
                                                        
attacked.owner.sendscreen(susetrue);
                                                    else 
attacked.monsterinfo.sendscreen(suse);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region chainbolt
                                
case 10309:
                                    {
                                        
msgmagiceffect suse = new msgmagiceffect(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((ulong)msgupdate.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.interacttype == msginteract.melee))
                                                        {
                                                            var 
damage calculate.magic(attackerattackedspellref attack);
                                                            
damage -= (uint)(damage .3);
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                }
                                                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.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
kernel.getdistance(xyattacked.xattacked.y) <= maxr)
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
maxr 6;
                                                                var 
damage2 calculate.magic(attackerattackedspellref attack);
                                                                
damage2 -= (uint)(damage2 .3);
                                                                
receiveattack(attackerattackedattackref damage2spell);
                                                                
suse.addtarget(attacked.uiddamage2attack);
                                                                
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((ulong)msgupdate.flags2.chainboltactive);
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region heaven blade
                                
case 10310:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (
attacked != null)
                                            {
                                                if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.distance)
                                                {
                                                    
msgmagiceffect suse = new msgmagiceffect(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 calculate.magic(attackerattackedspellref attack);
                                                        if (
kernel.rate(spell.percent))
                                                        {
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                        else
                                                        {
                                                            
damage 0;
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                        
attacker.owner.sendscreen(susetrue);
                                                    }
                                                }
                                                else
                                                {
                                                    
attacker.attackpacket null;
                                                }
                                            }
                                            else
                                            {
                                                if (
attackedsob != null)
                                                {
                                                    if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.distance)
                                                    {
                                                        
msgmagiceffect suse = new msgmagiceffect(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 calculate.magic(attackerattackedsobspellref attack);
                                                            if (
kernel.rate(spell.percent))
                                                            {
                                                                
receiveattack(attackerattackedsobattackdamagespell);

                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                            else
                                                            {
                                                                
damage 0;
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                            
attacker.owner.sendscreen(susetrue);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region fireofhell
                                
case 1165:
                                Case 
7014:
                                Case 
7017:
                                Case 
7015:
                                Case 
7011:
                                Case 
7012:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                {
                                                    
attacked _obj as player;
                                                    if (
sector.inside(attacked.xattacked.y))
                                                    {
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage calculate.magic(attackerattackedspellref attack);
                                                            
damage = (uint)(damage 2);
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                            if (
spell.id == 1165)
                                                            {
                                                                if (
attacked.playerflag == playerflag.player)
                                                                    
attacked.owner.breaktouch(attacker.owner);

                                                                
attacker.flamelotusenergy = (uint)math.min(330attacker.flamelotusenergy 1);
                                                                
attacker.lotus(attacker.flamelotusenergy, (byte)msgupdate.datatype.flamelotus);

                                                            }
                                                        }
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attackedsob _obj as msgnpcinfoex;
                                                    if (
sector.inside(attackedsob.xattackedsob.y))
                                                    {
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage calculate.magic(attackerattackedsobspellref attack);
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedsobattackdamagespell);
                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
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
                                            
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                            
msgmagiceffect.attacker attacker.uid;
                                            
msgmagiceffect.spellid spell.id;
                                            
msgmagiceffect.spelllevel spell.level;
                                            
msgmagiceffect.x;
                                            
msgmagiceffect.y;
                                            
msgmagiceffect.addtarget(attacker.uid, (uint)0attack);
                                            
attacker.owner.sendscreen(msgmagiceffecttrue);
                                            
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((byte)msgupdate.datatype.maxhitpointsattacker.transformationmaxhpfalse);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region bless
                                
case 9876:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                            
msgmagiceffect.attacker attacker.uid;
                                            
msgmagiceffect.spellid spell.id;
                                            
msgmagiceffect.spelllevel spell.level;
                                            
msgmagiceffect.x;
                                            
msgmagiceffect.y;
                                            
attacker.addflag((ulong)msgupdate.flags.castpray);
                                            
msgmagiceffect.addtarget(attacker.uid0attack);
                                            
attacker.owner.sendscreen(msgmagiceffecttrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region companions
                                
case 4000:
                                Case 
4010:
                                Case 
4020:
                                Case 
4050:
                                Case 
4060:
                                Case 
4070:
                                Case 
12020:
                                Case 
12030:
                                Case 
12040:
                                Case 
12050:
                                Case 
12470:
                                Case 
12480:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                            
msgmagiceffect.attacker attacker.uid;
                                            
msgmagiceffect.spellid spell.id;
                                            
msgmagiceffect.spelllevel spell.level;
                                            
msgmagiceffect.x;
                                            
msgmagiceffect.y;
                                            
msgmagiceffect.addtarget(attacker.uid0attack);
                                            
attacker.owner.sendscreen(msgmagiceffecttrue);
                                            
monsterinformation information monsterinformation.monsterinformations[spell.power];
                                            if (
information == null) return;
                                            
attacker.owner.pet.addpet(information);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region weapon
                                #region circle
                                
case 5010:
                                Case 
7020:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                        {
                                                            if (
attacked.containsflag((ulong)msgupdate.flags.fly)) return;
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
preparespell(spellattacker.owner);
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedref attackspell);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
preparespell(spellattacker.owner);
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region trytrip
                                
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.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.damage damage;
                                                        
suse.attacked attackedsob.uid;
                                                        
suse.effect1 attack.effect;
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                                else
                                                {
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.damage damage;
                                                        
suse.attacked attacked.uid;
                                                        
suse.effect1 attack.effect;
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                
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);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            if (
kernel.getdistance(attacker.xattacker.yxy) <= attacker.attackrange 1)
                                            {
                                                if (
attackedsob != null)
                                                {
                                                    if (
canattack(attackerattackedsobspell))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                        
damage = (uint)(damage 0.6);
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                                else
                                                {
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        
damage = (uint)(damage 0.6);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                
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);
                                            
msgmagiceffect suse = new msgmagiceffect(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)
                                                {
                                                    if (
_obj == null) continue;
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
sector.inside(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedref attackspell);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
sector.inside(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region archer
                                #region scatter
                                
case 8001:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                {
                                                    
attacked _obj as player;

                                                    if (
sector.inside(attacked.xattacked.y))
                                                    {
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage calculate.ranged(attackerattackedspellref attack);

                                                            
receiveattack(attackerattackedattackref damagespell);

                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attackedsob _obj as msgnpcinfoex;

                                                    if (
sector.inside(attackedsob.xattackedsob.y))
                                                    {
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage game.attacking.calculate.ranged(attackerattackedsobref attack);
                                                            
suse.effect attack.effect;
                                                            if (
damage == 0)
                                                                
damage 1;
                                                            
damage game.attacking.calculate.percent((int)damagespell.powerpercent);

                                                            
receiveattack(attackerattackedsobattackdamagespell);

                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region stararrow
                                
case 10313:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
//suse.spelllevelhu = client_spell.levelhu2;
                                            
if (attacked != null)
                                            {
                                                if (
canattack(attackerattackedspellattack.interacttype == msginteract.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.effect msginteract.interacteffects.none;
                                                    
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                    
receiveattack(attackerattackedattackref damagespell);

                                                    
suse.addtarget(attacked.uiddamageattack);
                                                }
                                            }
                                            else if (
attackedsob != null)
                                            {
                                                if (
canattack(attackerattackedsobspell))
                                                {
                                                    
suse.attackedsob.x;
                                                    
suse.attackedsob.y;
                                                    
attack.effect msginteract.interacteffects.none;
                                                    
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                    
suse.effect attack.effect;
                                                    if (
damage == 0)
                                                        
damage 1;
                                                    
damage game.attacking.calculate.percent((int)damagespell.powerpercent);

                                                    
receiveattack(attackerattackedsobattackdamagespell);

                                                    
suse.addtarget(attackedsob.uiddamageattack);
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region assassin
                                #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 msgtalk("you need to wear only knifes!"color.redmsgtalk.talk));
                                            return;
                                        }
                                        
msgmagiceffect spelluse = new msgmagiceffect(true);
                                        
spelluse.attacker attacker.uid;
                                        
spelluse.spellid spell.id;
                                        
spelluse.spelllevel spell.level;
                                        
spelluse.x;
                                        
spelluse.y;
                                        
attacker.owner.sendscreen(spellusetrue);
                                        
attacker.equipmentcolor = (uint)attacker.battlepower;
                                        if (
attacker.containsflag3((ulong)msgupdate.flags3.assassin))
                                        {
                                            
attacker.removeflag3((ulong)msgupdate.flags3.assassin);
                                            if (
attacker.containsflag3((ulong)msgupdate.flags3.bladeflurry))
                                                
attacker.removeflag3((ulong)msgupdate.flags3.bladeflurry);
                                            if (
attacker.containsflag3((ulong)msgupdate.flags3.kineticspark))
                                                
attacker.removeflag3((ulong)msgupdate.flags3.kineticspark);
                                        }
                                        else
                                            
attacker.addflag3((ulong)msgupdate.flags3.assassin);
                                        break;
                                    }
                                
#endregion
                                #region blade furry
                                
case 11610:
                                    {
                                        if (!
attacker.containsflag3((ulong)msgupdate.flags3.assassin))
                                            return;
                                        
msgmagiceffect suse = new msgmagiceffect(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((ulong)msgupdate.flags.xplist))
                                        {
                                            
attacker.addflag3((ulong)msgupdate.flags3.bladeflurry);
                                            
attacker.bladeflurrystamp time32.now;
                                            
attacker.removeflag((ulong)msgupdate.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.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedref attackspell);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                                
suse.effect attack.effect;

                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.owner.sendscreen(susetrue);
                                        break;
                                    }
                                
#endregion
                                #region mortal wound
                                
case 11660:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (!
attacker.containsflag3((ulong)msgupdate.flags3.assassin))
                                                return;
                                            if (
time32.now attacker.mortalwoundstamp.addmilliseconds(750))
                                            {
                                                
attacker.mortalwoundstamp time32.now;
                                                
preparespell(spellattacker.owner);
                                                
attacker.attackpacket null;
                                                
msgmagiceffect suse = new msgmagiceffect(true);
                                                
suse.attacker attacker.uid;
                                                
suse.spellid spell.id;
                                                
suse.spelllevel spell.level;
                                                
suse.x;
                                                
suse.y;
                                                if (
attackedsob == null)
                                                {
                                                    if (
canattack(attackerattackedspellfalse))
                                                    {
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage game.attacking.calculate.ranged(attackerattackedref attack);
                                                        
damage = (uint)(damage 1.1);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                        
attacker.owner.sendscreen(susetrue);
                                                    }
                                                }
                                                else
                                                {
                                                    if (
canattack(attackerattackedsobspell))
                                                    {
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage game.attacking.calculate.ranged(attackerattackedsobref attack);

                                                        
suse.effect attack.effect;

                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                        
attacker.owner.sendscreen(susetrue);
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region blistering wave
                                
case 11650:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (!
attacker.containsflag3((ulong)msgupdate.flags3.assassin))
                                                return;
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            
suse.leveljh client_spell.levelhu2;
                                            
sector sector = new sector(attacker.xattacker.yxy);
                                            
sector.arrange(120spell.range);
                                            foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                {
                                                    
attacked _obj as player;

                                                    if (
sector.inside(attacked.xattacked.y))
                                                    {
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage calculate.melee(attackerattackedref attackspell);
                                                            
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                            //{
                                                                
damage = (uint)(damage 0.01);
                                                            
//}
                                                            //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                            //{
                                                                //damage = (uint)(damage * 0.1);
                                                            //}
                                                            //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                            //{
                                                               // damage = (uint)(damage * 0.1);
                                                            //}
                                                            //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                            //{
                                                                //damage = (uint)(damage * 0.1);
                                                            //}
                                                            //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.baron)
                                                            //{
                                                                //damage = (uint)(damage * 0.01);
                                                            //}
                                                            //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.knight)
                                                            //{
                                                                //damage = (uint)(damage * 0.01);
                                                            //}
                                                            //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.serf)
                                                            //{
                                                                //damage = (uint)(damage * 0.01);
                                                            //}
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attackedsob _obj as msgnpcinfoex;

                                                    if (
sector.inside(attackedsob.xattackedsob.y))
                                                    {
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedsobattackdamagespell);
                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region spirit focus
                                
case 9000:
                                Case 
11670:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (
spell.id == 11670)
                                                if (!
attacker.containsflag3((ulong)msgupdate.flags3.assassin))
                                                    return;

                                            
preparespell(spellattacker.owner);

                                            
attack = new msginteract(true);
                                            
attack.attacker attacker.uid;
                                            
attack.attacked attacker.uid;
                                            
attack.interacttype msginteract.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((ulong)msgupdate.flags3.assassin))
                                            return;

                                        
msgmagiceffect spelluse = new msgmagiceffect(true);
                                        
spelluse.attacker attacker.uid;
                                        
spelluse.spellid spell.id;
                                        
spelluse.spelllevel spell.level;
                                        
spelluse.x;
                                        
spelluse.y;
                                        
attacker.owner.sendscreen(spellusetrue);

                                        if (
attacker.containsflag3((ulong)msgupdate.flags3.kineticspark))
                                            
attacker.removeflag3((ulong)msgupdate.flags3.kineticspark);
                                        else
                                            
attacker.addflag3((ulong)msgupdate.flags3.kineticspark);
                                        break;
                                    }
                                
#endregion
                                #region dagger storm
                                
case 11600:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (!
attacker.containsflag3((ulong)msgupdate.flags3.pathofshadow)) return;
                                            var 
map attacker.owner.map;
                                            if (!
map.floor[xymapobjecttype.itemnull]) return;
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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);
                                            
msgmapitem flooritem = new msgmapitem(true);
                                            if (
attacker.owner.spells[spellid].levelhu2 == 1)
                                                
flooritem.itemid msgmapitem.furyofegg;
                                            else if (
attacker.owner.spells[spellid].levelhu2 == 2)
                                                
flooritem.itemid msgmapitem.shacklingice;
                                            else
                                                
flooritem.itemid msgmapitem.daggerstorm;
                                            
flooritem.mapid attacker.mapid;
                                            
flooritem.type msgmapitem.effect;
                                            
flooritem.x;
                                            
flooritem.y;
                                            
flooritem.itemcolor enums.color.yellow;
                                            
flooritem.onfloor time32.now;
                                            
flooritem.owner attacker.owner;
                                            while (
map.npcs.containskey(flooritem.uid))
                                                
flooritem.uid msgmapitem.flooruid.next;
                                            
map.addflooritem(flooritem);
                                            
attacker.owner.sendscreenspawn(flooritemtrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region rapidfire
                                
case 8000:
                                    {
                                        if (
attackedsob != null)
                                        {
                                            if (
canusespell(spellattacker.owner))
                                            {
                                                if (
canattack(attackerattackedsobspell))
                                                {
                                                    
preparespell(spellattacker.owner);
                                                    
msgmagiceffect suse = new msgmagiceffect(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.effect msginteract.interacteffects.none;
                                                    
uint damage calculate.ranged(attackerattackedsobref attack);
                                                    
suse.effect attack.effect;
                                                    
suse.addtarget(attackedsob.uiddamageattack);

                                                    
receiveattack(attackerattackedsobattackdamagespell);
                                                    
attacker.owner.sendscreen(susetrue);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (!
attacked.dead)
                                            {
                                                if (
canusespell(spellattacker.owner))
                                                {
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                                        
suse.attacker attacker.uid;
                                                        
suse.spellid spell.id;
                                                        
suse.spelllevel spell.level;
                                                        
suse.attacked.x;
                                                        
suse.attacked.y;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.ranged(attackerattackedref attack);
                                                        
suse.addtarget(attacked.uiddamageattack);

                                                        
receiveattack(attackerattackedattackref damagespell);

                                                        
attacker.owner.sendscreen(susetrue);
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region fly
                                
case 8002:
                                Case 
8003:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (
attacker.mapid == 1950)
                                                return;
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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(attacker.uidattacker.flytimenull);

                                            
attacker.addflag((ulong)msgupdate.flags.fly);
                                            
attacker.removeflag((ulong)msgupdate.flags.ride);
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region windwalker
                                #region stomper
                                #region chillingsnow(active)
                                
case 12960:
                                    {
                                        if (
attacker.containsflag4((ulong)msgupdate.flags4.chillingsnow))
                                        {
                                            
attacker.removeflag4((ulong)msgupdate.flags4.chillingsnow);
                                            
attacker.attackpacket null;
                                            break;
                                        }
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
attacker.removeflag4((ulong)msgupdate.flags4.healingsnow);
                                            
attacker.removeflag4((ulong)msgupdate.flags4.freezingpelter);
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            
suse.addtarget(attacker.uid0attack);
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.addflag4((ulong)msgupdate.flags4.chillingsnow);
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region healingsnow(active)
                                
case 12950:
                                    {
                                        if (
attacker.containsflag4((ulong)msgupdate.flags4.healingsnow))
                                        {
                                            
attacker.removeflag4((ulong)msgupdate.flags4.healingsnow);
                                            
attacker.attackpacket null;
                                            break;
                                        }
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
attacker.removeflag4((ulong)msgupdate.flags4.chillingsnow);
                                            
attacker.removeflag4((ulong)msgupdate.flags4.freezingpelter);
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            
suse.addtarget(attacker.uid0attack);
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.addflag4((ulong)msgupdate.flags4.healingsnow);
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region freezingpelter(active)
                                
case 13020:
                                    {
                                        if (
attacker.containsflag4((ulong)msgupdate.flags4.freezingpelter))
                                        {
                                            
attacker.removeflag4((ulong)msgupdate.flags4.freezingpelter);
                                            
attacker.owner.loaditemstats();
                                            
attacker.attackpacket null;
                                            break;
                                        }
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
attacker.removeflag4((ulong)msgupdate.flags4.chillingsnow);
                                            
attacker.removeflag4((ulong)msgupdate.flags4.healingsnow);
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            
suse.addtarget(attacker.uid0attack);
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.addflag4((ulong)msgupdate.flags4.freezingpelter);
                                            
attacker.owner.loaditemstats();
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region revengetail(active)
                                
case 13030:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            
suse.addtarget(attacker.uid0attack);
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.addflag4((ulong)msgupdate.flags4.revengetaill);
                                            
attacker.revengetaillstamp time32.now;
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region burntfrost(passive)
                                
case 12940:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);


                                            
msgmagiceffect suse = new msgmagiceffect(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) <= spell.distance 1)
                                            {
                                                foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                                {
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        if (
_obj == null)
                                                            continue;
                                                        
attacked _obj as player;
                                                        if (
attacked == null) continue;
                                                        if (
sector.isinfan(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
uint damage calculate.melee(attackerattackedref attackspell);
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                                {
                                                                    
damage = (uint)(damage 0.3);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                                {
                                                                    
damage = (uint)(damage 0.3);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                                {
                                                                    
damage = (uint)(damage 0.3);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                                {
                                                                    
damage = (uint)(damage 0.3);
                                                                }
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        if (
_obj == null)
                                                            continue;
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
attackedsob == null) continue;
                                                        if (
sector.isinfan(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.attackpacket null;
                                        }
                                        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);
                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                {
                                                    
attacked _obj as player;
                                                    if (
ila.inline(attacked.xattacked.y))
                                                    {
                                                        if (!
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            continue;
                                                        if (
kernel.getdistance(attacked.xattacked.yattacker.xattacker.y) > 11) continue;
                                                        if (!
first)
                                                        {
                                                            var 
map kernel.maps[attacker.mapid];
                                                            
network.gamepackets.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
                                                            
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;
                                                            while (
map.npcs.containskey(flooritem.uid))
                                                                
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;

                                                            
flooritem.itemid msgmapitem.rageofwartrap;
                                                            
flooritem.attacked.x;
                                                            
flooritem.mapid map.id;
                                                            
flooritem.attacked.y;
                                                            
flooritem.type msgmapitem.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) * spell.power 25000;
                                                        
damage = (uint)(damage 0.5);

                                                        
receiveattack(attackerattackedattackref damagespell);

                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.monster)
                                                {
                                                    
attacked _obj as player;
                                                    if (
ila.inline(attacked.xattacked.y))
                                                    {
                                                        if (!
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            continue;
                                                        if (
kernel.getdistance(attacked.xattacked.yattacker.xattacker.y) > 11) continue;
                                                        if (!
first)
                                                        {
                                                            var 
map kernel.maps[attacker.mapid];
                                                            
network.gamepackets.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
                                                            
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;
                                                            while (
map.npcs.containskey(flooritem.uid))
                                                                
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;

                                                            
flooritem.itemid msgmapitem.rageofwartrap;
                                                            
flooritem.attacked.x;
                                                            
flooritem.mapid map.id;
                                                            
flooritem.attacked.y;
                                                            
flooritem.type msgmapitem.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) * (spell.power 1000) / 990;

                                                        
damage = (uint)(damage 0.6);

                                                        
receiveattack(attackerattackedattackref damagespell);

                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }


                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attackedsob _obj as msgnpcinfoex;
                                                    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.msgmapitem flooritem = new network.gamepackets.msgmapitem(true);
                                                            
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;
                                                            while (
map.npcs.containskey(flooritem.uid))
                                                                
flooritem.uid network.gamepackets.msgmapitem.flooruid.next;

                                                            
flooritem.itemid msgmapitem.rageofwartrap;
                                                            
flooritem.attackedsob.x;
                                                            
flooritem.mapid map.id;
                                                            
flooritem.attackedsob.y;
                                                            
flooritem.type msgmapitem.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(attackerattackedsobref attack) * (spell.power 5000) / 8000;

                                                        
damage = (uint)(damage 0.6);

                                                        
receiveattack(attackerattackedsobattackdamagespell);

                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }


                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region chaser
                                #region shadowofchaser(active)
                                
case 13090:
                                    {
                                        if (
attacker.containsflag4((ulong)msgupdate.flags4.shadowofchaser))
                                        {
                                            
attacker.removeflag4((ulong)msgupdate.flags4.shadowofchaser);
                                            
attacker.attackpacket null;
                                            break;
                                        }
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.addtarget(attacker.uid0null);
                                            
attack = new msginteract(true);
                                            
attack.attacker attack.attacked attacker.uid;
                                            
attack.attacker.xattack.attacker.y;
                                            
attack.interacttype 24;
                                            
attack.spellid spell.id;
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.addflag4((ulong)msgupdate.flags4.shadowofchaser);
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region tripleblasts(passive)
                                
case 12850:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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((ulong)msgupdate.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;
                                                            }
                                                        }
                                                    }

                                                    
uint damage game.attacking.calculate.ranged(attackerattackedref attack);
                                                    
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                    //{
                                                        
damage = (uint)(damage 0.8);
                                                    
//}
                                                    //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                    //{
                                                        //damage = (uint)(damage * 0.1);
                                                    //}
                                                    //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                    //{
                                                        //damage = (uint)(damage * 0.1);
                                                    //}
                                                    //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                    //{
                                                        //damage = (uint)(damage * 0.1);
                                                    //}
                                                    
damage damage * (attacked.playerflag == playerflag.player ? (spell.power 30000) : Spell.monsterpower) / 100;

                                                    
receiveattack(attackerattackedattackref damagespell);
                                                    
suse.addtarget(attacked.uiddamageattack);
                                                    
attacker.owner.sendscreen(susetrue);
                                                }
                                            }
                                            else
                                            {
                                                if (
canattack(attackerattackedsobspell))
                                                {

                                                    
uint damage game.attacking.calculate.ranged(attackerattackedsobref attack);

                                                    
receiveattack(attackerattackedsobattackdamagespell);
                                                    
suse.addtarget(attackedsob.uiddamageattack);
                                                    
attacker.owner.sendscreen(susetrue);
                                                }
                                            }

                                        }
                                        break;
                                    }
                                
#endregion
                                #region swirlingstorm(passive)
                                
case 12890:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                {
                                                    
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 player;

                                                        if (
sector.inside(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
int damagesec2 spell.humanpower;
                                                                
int damagesec = (spell.humanpower - ((spell.level 2) - 100));
                                                                var 
dis kernel.getdistance(attacker.xattacker.yattacked.xattacked.y);
                                                                
damagesec += (damagesec2 damagesec) / dis;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attackspell) * (uint)damagesec 10000;
                                                                
damage = (uint)(damage 1.2);
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                                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 player;

                                                        if (
sector.inside(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
int damagesec2 400;
                                                                
int damagesec 0;
                                                                if (
spell.level == 0damagesec 2600;
                                                                if (
spell.level == 1damagesec 2700;
                                                                if (
spell.level == 2damagesec 2800;
                                                                if (
spell.level == 3damagesec 2900;
                                                                if (
spell.level == 4damagesec 3000;
                                                                var 
dis kernel.getdistance(attacker.xattacker.yattacked.xattacked.y);
                                                                
damagesec += (damagesec2 damagesec) / dis;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attackspell) * (uint)damagesec 10000;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                                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 msgnpcinfoex;
                                                        if (
attackedsob == null) continue;
                                                        if (
sector.inside(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
int damagesec2 4000;
                                                                
int damagesec 0;
                                                                if (
spell.level == 0damagesec 2600;
                                                                if (
spell.level == 1damagesec 2700;
                                                                if (
spell.level == 2damagesec 2800;
                                                                if (
spell.level == 3damagesec 2900;
                                                                if (
spell.level == 4damagesec 3000;
                                                                var 
dis kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y);
                                                                
damagesec += (damagesec2 damagesec) / dis;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack) * (uint)damagesec 10000;
                                                                
damage = (uint)(damage 1.2);
                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        else
                                        {
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region thundercloud[chaser]
                                
case 12840:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
attacker.greeneffect 10;
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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(active)
                                
case 12970:
                                    {
                                        if (!
attacker.owner.spells.containskey(12840)) break;
                                        foreach (var 
th in kernel.maps[attacker.mapid].entities.values.where(=> i.name == "thundercloud"))
                                        {
                                            if (
th.owneruid == attacker.uid)
                                            {
                                                if (
kernel.getdistance(attacker.xattacker.yth.xth.y) <= th.monsterinfo.attackrange)
                                                {
                                                    if (
canusespell(spellattacker.owner))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                                        
suse.attacker attacker.uid;
                                                        
suse.x;
                                                        
suse.y;
                                                        
suse.spellid spell.id;
                                                        
suse.addtarget(th.uid0null);
                                                        
writer.write(12850th.spawnpacket);//flag4(128)
                                                        
attacker.owner.sendscreen(susetrue);
                                                        
attacker.attackpacket null;
                                                        foreach (var 
client in kernel.gamepool.values.where(=> kernel.getdistance(th.xth.yi.player.xi.player.y) < 17))
                                                        {
                                                            
client.send(th.spawnpacket);
                                                        }

                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region omnipotence(xp)
                                
case 12860:
                                    {
                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                        
suse.attacker attacker.uid;
                                        
suse.spellid spell.id;
                                        
suse.spelllevel spell.level;
                                        
suse.x;
                                        
suse.y;
                                        if (
attacker.containsflag((ulong)msgupdate.flags.xplist))
                                        {
                                            
attacker.addflag4((ulong)msgupdate.flags4.omnipotence);
                                            
attacker.omnipotencestamp time32.now;
                                            
attacker.removeflag((ulong)msgupdate.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.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {

                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attackspell) / 10;

                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
attackedsob == null) continue;
                                                        if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {

                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack) * 350 100;


                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.monster)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {

                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attackspell) * 350 100;

                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        
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);
                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                {
                                                    
attacked _obj as player;

                                                    if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                    {
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.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
                                #endregion
                                #region ninja
                                #region twilightdance
                                
case 12070:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
laytrapthree line = new laytrapthree(attacker.xxattacker.yy15);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spellid;
                                            
suse.spelllevel attacker.owner.spells[spellid].level;
                                            
suse.x;
                                            
suse.y;
                                            
int stamp 300;
                                            
ushort color 2;
                                            list<
msgmapitemitems = new list<msgmapitem>();
                                            foreach (var 
coords in line.lcoords)
                                            {
                                                if (!
attacker.floorspells.containskey(spellid))
                                                    
attacker.floorspells.tryadd(spellid, new floorspell.clientfloorspells(attacker.uidxysuse.leveljhspell));
                                                var 
msgmapitem = new floorspell(network.gamepackets.msgmapitem.twilightdance, (ushort)coords.x, (ushort)coords.ycolorspellstamp);
                                                
attacker.floorspells[spellid].additem(msgmapitem);
                                                
color++;
                                                
stamp += 400;
                                                
attacker.owner.sendscreen(msgmapitem.floorpackettrue);
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region supertwofoldblade
                                
case 12080:
                                    {
                                        if (
time32.now >= attacker.spellstamp.addmilliseconds(500))
                                        {
                                            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((ulong)msgupdate.flags.fly)) return;
                                                    if (
attacker.containsflag((ulong)msgupdate.flags.fly)) return;
                                                    
preparespell(spellattacker.owner);
                                                    
msgmagiceffect suse = new msgmagiceffect(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.interacttype == msginteract.melee))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage calculate.melee(attackerattackedref attackspell);
                                                            
damage = (uint)(damage 1.6);

                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                            
send true;
                                                            if (
attacker.owner.spells.containskey(11230) && !attacked.dead)
                                                            {
                                                                var 
attacker.owner.spells[11230];
                                                                var 
spellz spelltable.spellinformations[s.id][s.level];
                                                                if (
spellz != null)
                                                                {
                                                                    if (
kernel.rate(spellz.percent))
                                                                    {
                                                                        
msgmagiceffect ssuse = new msgmagiceffect(true);
                                                                        
ssuse.attacker attacker.uid;
                                                                        
ssuse.spellid spellz.id;
                                                                        
ssuse.spelllevel spellz.level;
                                                                        
damage calculate.melee(attackerattackedref attack) / 30;
                                                                        
ssuse.addtarget(attacked.uid, new msgmagiceffect.damageclass().damage damageattack);
                                                                        
receiveattack(attackerattackedattackref damagespellz);
                                                                        
attacker.owner.sendscreen(ssusetrue);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage calculate.melee(attackerattackedsobref attack);
                                                            
receiveattack(attackerattackedsobattackdamagespell);
                                                            
suse.effect attack.effect;
                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                            
send true;
                                                        }
                                                    }
                                                    if (
send)
                                                        
attacker.owner.sendscreen(susetrue);
                                                    
attacker.spellstamp time32.now;
                                                }
                                                else
                                                {
                                                    
attacker.attackpacket null;
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region shadowclone
                                
case 12090:
                                    {
                                        if (
attacker.myclones.count != 0)
                                        {
                                            foreach (var clone 
in attacker.myclones)
                                                clone.
removethat();
                                            
attacker.myclones.clear();
                                            break;
                                        }
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spellid;
                                            
suse.spelllevel attacker.owner.spells[spellid].level;
                                            
suse.x;
                                            
suse.y;
                                            switch (
attacker.owner.spells[spellid].level)
                                            {
                                                case 
0:
                                                Case 
1:
                                                Case 
2:
                                                    {
                                                        
attacker.myclones.add(new clone(attacker"shadowclone"10003));
                                                        break;
                                                    }
                                                default:
                                                    {
                                                        
attacker.myclones.add(new clone(attacker"shadowclone"3));
                                                        
attacker.myclones.add(new clone(attacker"shadowclone"10003));
                                                        break;
                                                    }
                                            }
                                            foreach (var clone 
in attacker.myclones)
                                            {
                                                
msgaction data = new msgaction(true);
                                                
data.id msgaction.mode.revive;
                                                
data.uid = clone.uid;
                                                
data.attacker.x;
                                                
data.attacker.y;
                                                
attacker.owner.sendscreen(datatrue);
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region fatalspin
                                
case 12110:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spellid;
                                            
suse.spelllevel attacker.owner.spells[spellid].level;
                                            
suse.x;
                                            
suse.y;
                                            
rangemove movein = new rangemove();
                                            list<
rangemove.coordsranger movein.movecoords(attacker.xattacker.yxy7);
                                            foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                            {
                                                if (
_obj == null) continue;
                                                if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                {
                                                    
attacked _obj as player;
                                                    if (!
movein.inrange(attacked.xattacked.y2ranger)) continue;
                                                    {
                                                        if (!
canattack(attackerattackedspellattack.interacttype == msginteract.melee)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        
                                                        
damage = (uint)(damage 0.1);
                                                            
                                                        
suse.effect attack.effect;
                                                        
attack.damage damage;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attackedsob _obj as msgnpcinfoex;
                                                    if (
attackedsob == null) continue;
                                                    if (!
movein.inrange(attackedsob.xattackedsob.y2ranger)) continue;
                                                    {
                                                        if (!
canattack(attackerattackedsobspell)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                        
attack.damage damage;
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region vortex
                                
case 6010:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            
attacker.addflag((ulong)msgupdate.flags.shurikenvortex);
                                            
attacker.removeflag((ulong)msgupdate.flags.ride);
                                            
attacker.shurikenvortexstamp time32.now;
                                            
attacker.shurikenvortextime 20;
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.vortexpacket = new msginteract(true);
                                            
attacker.vortexpacket.decoded true;
                                            
attacker.vortexpacket.damage 6012;
                                            
attacker.vortexpacket.interacttype msginteract.magic;
                                            
attacker.vortexpacket.attacker attacker.uid;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region vortexrespone
                                
case 6012:
                                    {
                                        if (!
attacker.containsflag((ulong)msgupdate.flags.shurikenvortex))
                                        {
                                            
attacker.attackpacket null; break;
                                        }
                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                        
suse.attacker attacker.uid;
                                        
suse.spellid spell.id;
                                        
suse.spelllevel spell.level;
                                        
suse.attacker.x;
                                        
suse.attacker.y;
                                        foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                        {
                                            if (
_obj == null) continue;
                                            if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                            {
                                                
attacked _obj as player;
                                                if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                {
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attack);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                            }
                                            else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                            {
                                                
attackedsob _obj as msgnpcinfoex;
                                                if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.range)
                                                {
                                                    if (
canattack(attackerattackedsobspell))
                                                    {
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.owner.sendscreen(susetrue);
                                        break;
                                    }
                                
#endregion
                                #region toxicfog
                                
case 6001:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            if (
kernel.getdistance(attacker.xattacker.yxy) <= spell.distance)
                                            {
                                                foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                                {
                                                    if (
_obj.mapobjtype == mapobjecttype.player || _obj.mapobjtype == mapobjecttype.monster)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
attacked.mapobjtype == mapobjecttype.monster)
                                                            if (
attacked.monsterinfo.boss) continue;
                                                        if (
kernel.getdistance(xyattacked.xattacked.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.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((ulong)msgupdate.flags.poisoned);
                                                                    
suse.addtarget(attacked.uid1null);
                                                                }
                                                                else
                                                                {
                                                                    
suse.addtarget(attacked.uid0null);
                                                                    
suse.targets[attacked.uid].hit false;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion

                                #region twofoldblades
                                
case 6000:
                                    {
                                        if (
time32.now >= attacker.spellstamp.addmilliseconds(500))
                                        {
                                            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.range)
                                                {
                                                    if (
attackedsob == null)
                                                        if (
attacked.containsflag((ulong)msgupdate.flags.fly)) return;
                                                    if (
attacker.containsflag((ulong)msgupdate.flags.fly)) return;
                                                    
preparespell(spellattacker.owner);
                                                    
msgmagiceffect suse = new msgmagiceffect(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.interacttype == msginteract.melee))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage calculate.melee(attackerattackedref attackspell);
                                                            if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                                
                                                                
damage = (uint)(damage 1.4);
                                                            
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                            
send true;
                                                            if (
attacker.owner.spells.containskey(11230) && !attacked.dead)
                                                            {
                                                                var 
attacker.owner.spells[11230];
                                                                var 
spellz spelltable.spellinformations[s.id][s.level];
                                                                if (
spellz != null)
                                                                {
                                                                    if (
mr.hamooo.kernel.rate(spellz.percent))
                                                                    {
                                                                        
msgmagiceffect ssuse = new msgmagiceffect(true);
                                                                        
ssuse.attacker attacker.uid;
                                                                        
ssuse.spellid spellz.id;
                                                                        
ssuse.spelllevel spellz.level;
                                                                        
damage calculate.melee(attackerattackedref attack) / 30;
                                                                        
ssuse.addtarget(attacked.uid, new msgmagiceffect.damageclass().damage damageattack);
                                                                        
receiveattack(attackerattackedattackref damagespellz);
                                                                        
attacker.owner.sendscreen(ssusetrue);
                                                                    }
                                                                }
                                                            }
                                                        }
                                                    }
                                                    else
                                                    {
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            
uint damage calculate.melee(attackerattackedsobref attack);
                                                            
receiveattack(attackerattackedsobattackdamagespell);
                                                            
suse.effect attack.effect;
                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                            
send true;
                                                        }
                                                    }
                                                    if (
send)
                                                        
attacker.owner.sendscreen(susetrue);
                                                    
attacker.spellstamp time32.now;
                                                }
                                                else
                                                {
                                                    
attacker.attackpacket null;
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region poisonstar
                                
case 6002:
                                    {
                                        if (
attackedsob != null) return;
                                        if (
attacked.playerflag == playerflag.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;
                                                
msgmagiceffect suse = new msgmagiceffect(true);
                                                
suse.attacker attacker.uid;
                                                
suse.spellid spell.id;
                                                
suse.spelllevel spell.level;
                                                
suse.x;
                                                
suse.y;
                                                if (
canattack(attackerattackedspellfalse))
                                                {
                                                    
suse.addtarget(attacked.uid1attack);
                                                    if (
kernel.rate(rate))
                                                    {
                                                        
attacked.nodrugsstamp time32.now;
                                                        
attacked.nodrugstime = (short)spell.duration;
                                                        
attacked.addflag2((ulong)msgupdate.flags2.poisonstar);
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
attacked.owner.send(constants.nodrugs(spell.duration));
                                                    }
                                                    else
                                                    {
                                                        
suse.targets[attacked.uid].hit false;
                                                    }
                                                    
attacked.owner.sendscreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region archerbane
                                
case 6004:
                                    {
                                        if (
attackedsob != null) return;
                                        if (
attacked.playerflag == playerflag.monster) return;
                                        if (!
attacked.containsflag((ulong)msgupdate.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;
                                                
msgmagiceffect suse = new msgmagiceffect(true);
                                                
suse.attacker attacker.uid;
                                                
suse.spellid spell.id;
                                                
suse.spelllevel spell.level;
                                                
suse.x;
                                                
suse.y;
                                                if (
canattack(attackerattackedspellfalse))
                                                {
                                                    
uint dmg calculate.percent(attacked0.1f);
                                                    
suse.addtarget(attacked.uiddmgattack);
                                                    if (
kernel.rate(rate))
                                                    {
                                                        
attacked.hitpoints -= dmg;
                                                        
attacked.removeflag((ulong)msgupdate.flags.fly);
                                                    }
                                                    else
                                                    {
                                                        
suse.targets[attacked.uid].hit false;
                                                    }
                                                    
attacked.owner.sendscreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region mortaldrag
                                
case 11180:
                                    {
                                        if (
attacked != null)
                                        {
                                            if (
attacked.containsflag((ulong)msgupdate.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);
                                                    
msgmagiceffect suse = new msgmagiceffect(true);
                                                    
suse.attacker attacker.uid;
                                                    
suse.spellid spell.id;
                                                    
suse.spelllevel spell.level;
                                                    
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.playerattacked])
                                                    {
                                                        
suse.attacked.newx;
                                                        
suse.attacked.newy;
                                                    }
                                                    
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
                                                    if (
canattack(attackerattackedspellfalse))
                                                    {
                                                        
tar.damage calculate.melee(attackerattackedref attackspell);
                                                        
suse.addtarget(attacked.uidtarattack);
                                                        
receiveattack(attackerattackedattackref tar.damagespell);
                                                    }
                                                    if (
attacker.playerflag == playerflag.player)
                                                        
attacker.owner.sendscreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region bloodyscythe
                                
case 11170:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
                                            foreach (var 
t in attacker.owner.screen.objects)
                                            {
                                                if (
== null) continue;
                                                if (
t.mapobjtype == mapobjecttype.player || t.mapobjtype == mapobjecttype.monster)
                                                {
                                                    var 
target as player;
                                                    if (
kernel.getdistance(xytarget.xtarget.y) <= spell.range)
                                                    {
                                                        if (
canattack(attackertargetspellfalse))
                                                        {
                                                            
tar.damage calculate.melee(attackertargetref attackspell) / 2;
                                                            
tar.hit true;
                                                            
suse.addtarget(target.uidtarattack);
                                                            
receiveattack(attackertargetattackref tar.damagespell);
                                                        }
                                                    }
                                                }
                                            }
                                            if (
attacker.playerflag == playerflag.player)
                                                
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region steed
                                #region riding
                                
case 7001:
                                    {
                                        if (
constants.noriding.contains(attacker.mapid))
                                        {
                                            
attacker.owner.send(new msgtalk("mr: " attacker.name " you can`t use riding here !!!"system.drawing.color.redmsgtalk.world));
                                            return;
                                        }
                                        if (
attacker.containsflag((ulong)msgupdate.flags.shurikenvortex))
                                            return;
                                        if (!
attacker.owner.equipment.free(12))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            if (
attacker.containsflag((ulong)msgupdate.flags.ride))
                                            {
                                                
attacker.removeflag((ulong)msgupdate.flags.ride);
                                            }
                                            else
                                            {
                                                if (
attacker.stamina >= 30)
                                                {
                                                    
attacker.addflag((ulong)msgupdate.flags.ride);
                                                    
attacker.stamina -= 30;
                                                    
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(attacker.uid0attack);
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }

                                
#endregion
                                #region spook
                                
case 7002:
                                    {
                                        if (
attacked.containsflag((ulong)msgupdate.flags.ride) && attacker.containsflag((ulong)msgupdate.flags.ride))
                                        {
                                            
msgiteminfo attackedsteed nullattackersteed null;
                                            if ((
attackedsteed attacked.owner.equipment.trygetitem(msgiteminfo.steed)) != null)
                                            {
                                                if ((
attackersteed attacker.owner.equipment.trygetitem(msgiteminfo.steed)) != null)
                                                {
                                                    
msgmagiceffect suse = new msgmagiceffect(true);
                                                    
suse.attacker attacker.uid;
                                                    
suse.spellid spell.id;
                                                    
suse.spelllevel spell.level;
                                                    
suse.x;
                                                    
suse.y;
                                                    
suse.addtarget(attacked.uid0attack);
                                                    if (
attackedsteed.plus attackersteed.plus)
                                                        
attacked.removeflag((ulong)msgupdate.flags.ride);
                                                    else if (
attackedsteed.plus == attackersteed.plus && attackedsteed.plusprogress <= attackersteed.plusprogress)
                                                        
attacked.removeflag((ulong)msgupdate.flags.ride);
                                                    else
                                                        
suse.targets[attacked.uid].hit false;
                                                    
attacker.owner.sendscreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region warcry
                                
case 7003:
                                    {
                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                        
suse.attacker attacker.uid;
                                        
suse.spellid spell.id;
                                        
suse.spelllevel spell.level;
                                        
suse.x;
                                        
suse.y;
                                        
msgiteminfo attackedsteed nullattackersteed null;
                                        foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                        {
                                            if (
_obj == null) continue;
                                            if (
_obj.mapobjtype == mapobjecttype.player && _obj.uid != attacker.uid)
                                            {
                                                
attacked _obj as player;
                                                if ((
attackedsteed attacked.owner.equipment.trygetitem(msgiteminfo.steed)) != null)
                                                {
                                                    if ((
attackersteed attacker.owner.equipment.trygetitem(msgiteminfo.steed)) != null)
                                                    {
                                                        if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= attackedsteed.plus)
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
suse.addtarget(attacked.uid0attack);
                                                                if (
attackedsteed.plus attackersteed.plus)
                                                                    
attacked.removeflag((ulong)msgupdate.flags.ride);
                                                                else if (
attackedsteed.plus == attackersteed.plus && attackedsteed.plusprogress <= attackersteed.plusprogress)
                                                                    
attacked.removeflag((ulong)msgupdate.flags.ride);
                                                                else
                                                                    
suse.targets[attacked.uid].hit false;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        
attacker.owner.sendscreen(susetrue);
                                        break;
                                    }
                                
#endregion
                                #region chargingvortex
                                
case 11190:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (
attacker.owner.map.floor[xymapobjecttype.invalidcastnull]) break;
                                            
spell.usestamina 20;
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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.interacttype msginteract.skillmove;
                                            
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.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
kernel.getdistance(xyattacked.xattacked.y) > spell.range) continue;
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            var 
damage calculate.melee(attackerattackedref attackspell);
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
uint damage calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
calculations.isbreaking(attacker.owneroxoy);
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.owner.screen.reload(suse);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region monk
                                #region elementalaura
                                
case 10395:
                                Case 
10410:
                                Case 
10420:
                                Case 
10421:
                                Case 
10422:
                                Case 
10423:
                                Case 
10424:
                                    {
                                        
handleauramonk(attackerspell);
                                        break;
                                    }
                                
#endregion
                                #region compassion
                                
case 10430:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
msgmagiceffect suse = new msgmagiceffect(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((ulong)msgupdate.flags.poisoned);
                                                        
suse.addtarget(teammate.player.uid0attack);
                                                    }
                                                }
                                                
attacker.owner.sendscreen(susetrue);
                                            }
                                            else
                                            {
                                                
preparespell(spellattacker.owner);
                                                
attacker.removeflag((ulong)msgupdate.flags.poisoned);
                                                
suse.addtarget(attacker.uid0attack);
                                                if (
attacked.playerflag == playerflag.player)
                                                    
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;
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spellid;
                                            
suse.spelllevel attacker.owner.spells[spellid].level;
                                            
suse.x;
                                            
suse.y;
                                            
suse.targets.add(attacker.uid1);
                                            
attacked.toxicfogleft 0;
                                            
attacked.nodrugstime 0;
                                            
attacked.scurbybomb 0;
                                            
attacked.dragonfurytime 0;
                                            
attacked.flamelayerleft 0;
                                            if (
attacked.containsflag2((ulong)msgupdate.flags2.scurvybomb))
                                                
attacked.removeflag2((ulong)msgupdate.flags2.scurvybomb);
                                            if (
attacked.containsflag2((ulong)msgupdate.flags2.poisonstar))
                                                
attacked.removeflag2((ulong)msgupdate.flags2.poisonstar);
                                            
msgupdate upgrade = new msgupdate(true);
                                            
upgrade.uid attacker.uid;
                                            
upgrade.append((byte)msgupdate.datatype.fatigue0000);
                                            
attacked.owner.send(upgrade.toarray());
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region tranquility
                                
case 10425:
                                    {
                                        if (
attacker.epicmonk())
                                        {
                                            
attack.interacttype msginteract.magic;
                                            
attack.decoded true;
                                            
attack.attacked.x;
                                            
attack.attacked.y;
                                            
attack.attacked attacked.uid;
                                            
attack.attacker attacker.uid;
                                            
attack.damage 12560;
                                            goto 
restart;
                                        }
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            if (
attacked == null) return;
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spellid;
                                            
suse.spelllevel attacker.owner.spells[spellid].level;
                                            
suse.x;
                                            
suse.y;
                                            
suse.addtarget(attacked.uid0attack);
                                            if (
attacked != null && attacked.playerflag == playerflag.player)
                                            {
                                                if (
attacked.containsflag2((ulong)msgupdate.flags2.soulshackle))
                                                {
                                                    
msgupdate upgrade = new msgupdate(true);
                                                    
upgrade.uid attacked.uid;
                                                    
upgrade.append((byte)msgupdate.datatype.soulshackle111000);
                                                    
attacked.owner.send(upgrade.toarray());
                                                }
                                                
attacked.toxicfogleft 0;
                                                
attacked.scurbybomb 0;
                                                
attacked.nodrugstime 0;
                                                
attacked.dragonfurytime 0;
                                                
attacked.flamelayerleft 0;
                                                if (
attacked.dead)
                                                {
                                                    
attacked.soulshackleremover();
                                                }
                                                if (
attacked.playerflag == playerflag.player)
                                                    
attacker.owner.sendscreen(susetrue);
                                                else 
attacked.monsterinfo.sendscreen(suse);
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region whirlwindkick
                                
case 10415:
                                    {
                                        if (
time32.now attacker.spellstamp.addmilliseconds(300))
                                        {
                                            
attacker.attackpacket null; return;
                                        }
                                        if (
kernel.getdistance(attacker.xattacker.yxy) <= 3)
                                        {
                                            if (
canusespell(spellattacker.owner))
                                            {
                                                
preparespell(spellattacker.owner);

                                                
msgmagiceffect suse = new msgmagiceffect(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) <= 3)
                                                {
                                                    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.player)
                                                        {
                                                            
attacked _obj as player;
                                                            if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                            {
                                                                if (
canattack(attackerattackedspellattack.interacttype == msginteract.ranged))
                                                                {
                                                                    
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                                    
damage = (uint)(damage 0.6);
                                                                    
suse.effect attack.effect;
                                                                    
receiveattack(attackerattackedattackref damagespell);
                                                                    
attacked.stunned true;
                                                                    
attacked.stunstamp time32.now;
                                                                    
suse.addtarget(attacked.uiddamageattack);

                                                                }
                                                            }
                                                        }
                                                    }
                                                    
attacker.attackpacket null;
                                                }
                                                else
                                                {
                                                    
attacker.attackpacket null; return;
                                                }
                                                
attacker.owner.sendscreen(susetrue);
                                                
attacker.spellstamp time32.now;
                                                
suse.targets = new safedictionary<uintmsgmagiceffect.damageclass>();
                                                
attacker.attackpacket null; return;
                                            }
                                            
attacker.attackpacket null;
                                        }
                                        
attacker.attackpacket null; return;
                                    }
                                
#endregion
                                #region radiantpalm
                                
case 10381:
                                    {
                                        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) <= spell.range)
                                            {
                                                if (
attackedsob == null)
                                                    if (
attacked.containsflag((ulong)msgupdate.flags.fly)) return;
                                                if (
attacker.containsflag((ulong)msgupdate.flags.fly)) return;
                                                
preparespell(spellattacker.owner);
                                                
msgmagiceffect suse = new msgmagiceffect(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.interacttype == msginteract.melee))
                                                    {

                                                        
attack.effect msginteract.interacteffects.none;
                                                        var 
damage calculate.melee(attackerattackedref attack);
                                                        
/*if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                            if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                            {
                                                                damage = (uint)(damage * 1.2);
                                                            }
                                                        if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                        {
                                                            damage = (uint)(damage * 1.2);
                                                        }
                                                        if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                        {
                                                            damage = (uint)(damage * 1.2);
                                                        }
                                                        if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                        {*/
                                                            
damage = (uint)(damage 1.3);
                                                        
//}
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                        
send true;
                                                    }
                                                }
                                                else
                                                {
                                                    if (
canattack(attackerattackedsobspell))
                                                    {
                                                        
attack.effect msginteract.interacteffects.none;
                                                        var 
damage calculate.melee(attackerattackedsobref attack);
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.effect attack.effect;
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                        
send true;
                                                    }
                                                }
                                                if (
send)
                                                    
attacker.owner.sendscreen(susetrue);
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region soulshackle
                                
case 10405:
                                    {
                                        if (
canusespell(spellattacker.owner) && attacked.dead)
                                        {
                                            if (
attacked.playerflag == playerflag.player)
                                            {
                                                
msgmagiceffect suse = new msgmagiceffect(true);
                                                
suse.attacker attacker.uid;
                                                
suse.spellid spell.id;
                                                
suse.spelllevel spell.level;
                                                
suse.x;
                                                
suse.y;
                                                
suse.addtarget(attacked.uid0attack);
                                                if (
attacked.dead)
                                                {
                                                    if (
attacker.battlepower >= attacked.battlepower ||
                                                        
attacker.battlepower > (attacked.battlepower 15))
                                                    {
                                                        
attacked.shacklestamp time32.now;
                                                        
attacked.shackletime = (short)spell.duration;
                                                        
msgupdate upgrade = new msgupdate(true);
                                                        
upgrade.uid attacked.uid;
                                                        
upgrade.append((byte)msgupdate.datatype.soulshackle111, (uint)spell.duration00);
                                                        
attacked.owner.send(upgrade.toarray());
                                                        
attacked.addflag2((ulong)msgupdate.flags2.soulshackle);
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
attacked.owner.sendscreen(susetrue);
                                                    }
                                                }
                                            }
                                            
attacker.attackpacket null;
                                            break;
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region pirate
                                #region galebomb
                                
case 11070:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
map map;
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
                                            
int num 0;
                                            switch (
spell.level)
                                            {
                                                case 
0:
                                                Case 
1Num 3; break;
                                                case 
2:
                                                Case 
3Num 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.player || t.mapobjtype == mapobjecttype.monster)
                                                {
                                                    var 
target as player;
                                                    if (
kernel.getdistance(xytarget.xtarget.y) <= spell.range)
                                                    {
                                                        if (
canattack(attackertargetspellfalse))
                                                        {
                                                            
tar.damage calculate.melee(attackertargetref attackspell);
                                                            
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.playerattacker])
                                                                {
                                                                    
target.tar.newx;
                                                                    
target.tar.newy;
                                                                }
                                                                else
                                                                {
                                                                    
tar.newx target.x;
                                                                    
tar.newy target.y;
                                                                }
                                                            }
                                                            else
                                                            {
                                                                if (
attacker.owner.map.floor[tar.newxtar.newymapobjecttype.playerattacker])
                                                                {
                                                                    
target.tar.newx;
                                                                    
target.tar.newy;
                                                                }
                                                                else
                                                                {
                                                                    
target.tar.newx;
                                                                    
target.tar.newy;
                                                                }
                                                            }
                                                            
suse.addtarget(target.uidtarattack);
                                                            
receiveattack(attackertargetattackref tar.damagespell);
                                                            
i++;
                                                            if (
num) break;
                                                        }
                                                    }
                                                }
                                            }
                                            if (
attacker.playerflag == playerflag.player)
                                                
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region bladetempest
                                
case 11110:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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.yydistinlinealgorithm.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.player]
                                                    && !
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.playernull]) 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 player;
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            var 
damage calculate.melee(attackerattackedref attackspell);
                                                            
receiveattack(attackerattackedattackref damagespell);

                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            var 
damage calculate.melee(attackerattackedref attackspell);
                                                            
/*if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                                if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                                {
                                                                    damage = (uint)(damage * 0.9);
                                                                }
                                                            if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                            {
                                                                damage = (uint)(damage * 0.9);
                                                            }
                                                            if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                            {
                                                                damage = (uint)(damage * 0.9);
                                                            }
                                                            if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                            {*/
                                                                
damage = (uint)(damage 1.0);
                                                            
//}
                                                            
receiveattack(attackerattackedattackref damagespell);

                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            var 
damage calculate.melee(attackerattackedsobref attack);
                                                            
receiveattack(attackerattackedsobattackdamagespell);

                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
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);
                                            
msgmagiceffect suse = new msgmagiceffect(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 
1Num 3; break;
                                                case 
2:
                                                Case 
3Num 4; break;
                                                default: 
Num 5; break;
                                            }
                                            
int i 0;
                                            
msgdeadmark bsp = new msgdeadmark();
                                            foreach (var 
t in attacker.owner.screen.objects.orderby(=> kernel.getdistance(x.xx.yattacker.owner.player.xattacker.owner.player.y)))
                                            {
                                                if (
== null)
                                                    continue;
                                                if (
t.mapobjtype == mapobjecttype.player || t.mapobjtype == mapobjecttype.monster)
                                                {
                                                    var 
target as player;
                                                    if (
canattack(attackertargetspellfalse))
                                                    {
                                                        
target.isblackspotted true;
                                                        
target.blackspotstamp time32.now;
                                                        
target.blackspotstepsecs spell.duration;
                                                        
kernel.blackspoted.tryadd(target.uidtarget);
                                                        
suse.addtarget(target.uid, new msgmagiceffect.damageclass(), attack);
                                                        
i++;
                                                        if (
== num) break;
                                                    }
                                                }
                                            }
                                            if (
attacker.playerflag == playerflag.player)
                                                
attacker.owner.sendscreen(susetrue);
                                            foreach (var 
h in server.gamepool)
                                            {
                                                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);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            if (
kernel.getdistance(attacker.xattacker.yxy) <= spell.distance)
                                            {
                                                foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                                {
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
kernel.getdistance(xyattacked.xattacked.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
int potdifference attacker.battlepower attacked.battlepower;
                                                                
int rate spell.percent potdifference;
                                                                if (
kernel.rate(rate))
                                                                {
                                                                    if (
_obj.mapobjtype == mapobjecttype.player)
                                                                    {
                                                                        
attacked.scurbybombstamp time32.now;
                                                                        
attacked.scurbybomb2stamp time32.now;
                                                                        
attacked.scurbybomb 20;
                                                                        
attacked.addflag2((ulong)msgupdate.flags2.scurvybomb);
                                                                        
msgupdate upgrade = new msgupdate(true);
                                                                        
upgrade.uid attacked.uid;
                                                                        
upgrade.append((byte)msgupdate.datatype.fatigue202000);
                                                                        
attacked.owner.send(upgrade.toarray());
                                                                    }
                                                                    
attack.effect msginteract.interacteffects.none;
                                                                    
uint damage calculate.melee(attackerattackedref attackspell);
                                                                    
suse.effect attack.effect;
                                                                    
receiveattack(attackerattackedattackref damagespell);
                                                                    
suse.targets.add(attacked.uiddamage);
                                                                }
                                                                else
                                                                {
                                                                    
suse.targets.add(attacked.uid0);
                                                                    
suse.targets[attacked.uid].hit false;
                                                                }
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region cannon barrage
                                
case 11050:
                                    {
                                        if (
attacker.owner.player.containsflag((ulong)msgupdate.flags.xplist))
                                        {
                                            
attacker.owner.player.removeflag((ulong)msgupdate.flags.xplist);
                                            
attacker.owner.player.addflag2((ulong)msgupdate.flags2.cannonbarrage);
                                            
attacker.owner.player.cannonbarragestamp time32.now;
                                            return;
                                        }
                                        
preparespell(spellattacker.owner);
                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                        
suse.attacker attacker.uid;
                                        
suse.spellid spell.id;
                                        
suse.spelllevel spell.level;
                                        
suse.x;
                                        
suse.y;
                                        
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
                                        foreach (var 
t in attacker.owner.screen.objects)
                                        {
                                            if (
== null) continue;
                                            if (
t.mapobjtype == mapobjecttype.player || t.mapobjtype == mapobjecttype.monster)
                                            {
                                                var 
target as player;
                                                if (
kernel.getdistance(attacker.owner.player.xattacker.owner.player.ytarget.xtarget.y) <= spell.range)
                                                {
                                                    if (
canattack(attackertargetspellfalse))
                                                    {
                                                        
tar.damage calculate.ranged(attackertargetref attack);
                                                        
receiveattack(attackertargetattackref tar.damagespell);
                                                        
suse.addtarget(target.uidtarattack);
                                                    }
                                                }
                                            }
                                        }
                                        if (
attacker.playerflag == playerflag.player)
                                            
attacker.owner.sendscreen(susetrue);
                                        break;
                                    }
                                
#endregion
                                #region blackbeard`srage
                                
case 11060:
                                    {
                                        if (
attacker.owner.player.containsflag((ulong)msgupdate.flags.xplist))
                                        {
                                            
attacker.owner.player.removeflag((ulong)msgupdate.flags.xplist);
                                            
attacker.owner.player.addflag2((ulong)msgupdate.flags2.blackbeardsrage);
                                            
attacker.owner.player.blackbeardsragestamp time32.now;
                                            return;
                                        }
                                        
int targets 0;
                                        switch (
spell.level)
                                        {
                                            case 
0:
                                            Case 
1Targets 3; break;
                                            case 
2:
                                            Case 
3Targets 4; break;
                                            default: 
Targets 5; break;
                                        }
                                        
int i 0;
                                        
preparespell(spellattacker.owner);
                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                        
suse.attacker attacker.uid;
                                        
suse.spellid spell.id;
                                        
suse.spelllevel spell.level;
                                        
suse.x;
                                        
suse.y;
                                        
msgmagiceffect.damageclass tar = new msgmagiceffect.damageclass();
                                        foreach (var 
t in attacker.owner.screen.objects)
                                        {
                                            if (
== null) continue;
                                            if (
t.mapobjtype == mapobjecttype.player || t.mapobjtype == mapobjecttype.monster)
                                            {
                                                var 
target as player;
                                                if (
kernel.getdistance(attacker.owner.player.xattacker.owner.player.ytarget.xtarget.y) <= spell.range)
                                                {
                                                    if (
canattack(attackertargetspellfalse))
                                                    {
                                                        
tar.damage calculate.ranged(attackertargetref attack);
                                                        
suse.addtarget(target.uidtarattack);
                                                        
receiveattack(attackertargetattackref tar.damagespell);
                                                        
i++;
                                                        if (
== targets) break;
                                                    }
                                                }
                                            }
                                        }
                                        if (
attacker.playerflag == playerflag.player)
                                            
attacker.owner.sendscreen(susetrue);
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region warrior
                                #region extraxp
                                
case 1040:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            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.distance)
                                                        {
                                                            
teammate.xpcount += 20;
                                                            
msgupdate update = new msgupdate(true);
                                                            
update.uid teammate.player.uid;
                                                            
update.append((byte)msgupdate.datatype.xpcircleteammate.xpcount);
                                                            
update.send(teammate);
                                                            
suse.targets.add(teammate.player.uid20);
                                                            if (
spell.nextspellid != 0)
                                                            {
                                                                
attack.damage spell.nextspellid;
                                                                
attacker.attackpacket attack;
                                                            }
                                                            else 
attacker.attackpacket null;
                                                        }
                                                    }
                                                }
                                            if (
attacked.playerflag == playerflag.player)
                                                
attacked.owner.sendscreen(susetrue);
                                            else 
attacked.monsterinfo.sendscreen(suse);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region dash
                                
case 1051:
                                    {
                                        if (
attacked != null)
                                        {
                                            if (!
attacked.dead)
                                            {
                                                var 
direction kernel.getangle(attacker.xattacker.yattacked.xattacked.y);
                                                if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                {
                                                    
attack = new msginteract(true);
                                                    
attack.effect msginteract.interacteffects.none;
                                                    
uint damage calculate.melee(attackerattackedref attack);
                                                    
attack.interacttype msginteract.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 magicdefender
                                
case 11200:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (
attacker.class >= 20 && attacker.class <= 25)
                                            {
                                                if (!
attacker.containsflag3((ulong)msgupdate.flags3.magicdefender))
                                                {
                                                    
preparespell(spellattacker.owner);
                                                    
msgmagiceffect suse = new msgmagiceffect(true);
                                                    
suse.attacker attacker.uid;
                                                    
suse.spellid spell.id;
                                                    
suse.spelllevel spell.level;
                                                    
suse.x;
                                                    
suse.y;
                                                    if (
attacker.containsflag3((ulong)msgupdate.flags3.magicdefender))
                                                    {
                                                        
attacker.removeflag3((ulong)msgupdate.flags3.magicdefender);
                                                        
attacker.removeflag2((ulong)msgupdate.flags2.magicdefendericon);
                                                    }
                                                    
attacker.magicdefenderstamp time32.now;
                                                    
attacker.magicdefender spell.duration;
                                                    
attacker.addflag3((ulong)msgupdate.flags3.magicdefender);
                                                    
attacker.addflag2((ulong)msgupdate.flags2.magicdefendericon);
                                                    
msgupdate upgrade = new msgupdate(true);
                                                    
upgrade.uid attacker.uid;
                                                    
upgrade.append((byte)msgupdate.datatype.azureshield128, (uint)spell.duration0spell.level);
                                                    
attacker.owner.send(upgrade.toarray());
                                                    
attacker.owner.sendscreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region shieldblock
                                
case 10470:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (
attacker.class >= 20 && attacker.class <= 25)
                                            {
                                                
preparespell(spellattacker.owner);
                                                
msgmagiceffect suse = new msgmagiceffect(true);
                                                
suse.attacker attacker.uid;
                                                
suse.spellid spell.id;
                                                
suse.spelllevel spell.level;
                                                
suse.x;
                                                
suse.y;
                                                
attacker.blockshieldstamp time32.now;
                                                
attacker.blockshield spell.duration;
                                                
attacker.blockshieldcheck true;
                                                
attacker.owner.reloadblock();
                                                
msgupdate upgrade = new msgupdate(true);
                                                
upgrade.uid attacker.uid;
                                                
upgrade.append((byte)msgupdate.datatype.azureshield113, (uint)spell.durationspell.powerspell.level);
                                                
attacker.owner.send(upgrade.toarray());
                                                
attacker.owner.sendscreen(susetrue);
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region defensivestance
                                
case 11160:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (
attacker.class >= 20 && attacker.class <= 25)
                                            {
                                                
preparespell(spellattacker.owner);
                                                
msgmagiceffect suse = new msgmagiceffect(true);
                                                
suse.attacker attacker.uid;
                                                
suse.spellid spell.id;
                                                
suse.spelllevel spell.level;
                                                
suse.x;
                                                
suse.y;
                                                if (
attacker.containsflag2((ulong)msgupdate.flags2.defensivestance))
                                                {
                                                    
attacker.removeflag2((ulong)msgupdate.flags2.defensivestance);
                                                    
attacker.defensivestance 0;
                                                }
                                                else if (!
attacker.containsflag2((ulong)msgupdate.flags2.defensivestance))
                                                {
                                                    
attacker.defensivestancestamp time32.now;
                                                    
attacker.defensivestance spell.duration;
                                                    
attacker.addflag2((ulong)msgupdate.flags2.defensivestance);
                                                    
msgupdate upgrade = new msgupdate(true);
                                                    
upgrade.uid attacker.uid;
                                                    
upgrade.append((byte)msgupdate.datatype.defensivestance126, (uint)spell.duration, (uint)spell.powerpercentspell.level);
                                                    
attacker.owner.send(upgrade.toarray());
                                                    
attacker.owner.sendscreen(susetrue);
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion

                                #region trojan
                                #region cruelshabe
                                
case 3050:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (
attackedsob != null)
                                            {
                                                if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.distance)
                                                {
                                                    
msgmagiceffect suse = new msgmagiceffect(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 calculate.percent(attackedsobspell.powerpercent);
                                                        
attackedsob.hitpoints -= damage;
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                        
attacker.owner.sendscreen(susetrue);
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.distance)
                                                {
                                                    
msgmagiceffect suse = new msgmagiceffect(true);
                                                    
suse.attacker attacker.uid;
                                                    
suse.spellid spell.id;
                                                    
suse.spelllevel spell.level;
                                                    
suse.x;
                                                    
suse.y;
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
uint damage calculate.percent(attackedspell.powerpercent);
                                                        if (
attacked.playerflag == playerflag.player)
                                                        {
                                                            
attacker.owner.updatequalifier(damage);
                                                        }
                                                        
attacked.hitpoints -= damage;
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
attacked.owner.sendscreen(susetrue);
                                                        else 
attacked.monsterinfo.sendscreen(suse);
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region supercyclone
                                
case 11970:
                                    {
                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                        
suse.attacker attacker.uid;
                                        
suse.spellid spell.id;
                                        
suse.spelllevel spell.level;
                                        
suse.x;
                                        
suse.y;
                                        if (
attacker.onsupercyclone()) return;
                                        if (
attacker.containsflag((ulong)msgupdate.flags.xplist))
                                        {
                                            if (!
attacked.onkospell())
                                                
attacked.kocount 0;
                                            
attacked.kospell spell.id;
                                            
attacked.supercyclonetime 40;
                                            
attacker.addflag3((ulong)msgupdate.flags3.supercyclone);
                                            
attacker.supercyclonestamp time32.now;
                                            
attacker.removeflag((ulong)msgupdate.flags.xplist);
                                        }
                                        
attacker.owner.sendscreen(susetrue);
                                        break;
                                    }
                                
#endregion
                                #region fatalcross
                                
case 11980:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spellid;
                                            
suse.spelllevel attacker.owner.spells[spellid].level;
                                            
suse.x;
                                            
suse.y;
                                            
rangemove movein = new rangemove();
                                            list<
rangemove.coordsranger movein.movecoords(attacker.xattacker.yxy);
                                            foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                            {
                                                if (
_obj == null) continue;
                                                if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                {
                                                    
attacked _obj as player;
                                                    if (!
movein.inrange(attacked.xattacked.y2ranger)) continue;
                                                    {
                                                        if (!
canattack(attackerattackedspellattack.interacttype == msginteract.melee)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        
//if (attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                        //{
                                                            
damage = (uint)(damage 1.3);
                                                        
//}
                                                        //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                        //{
                                                           // damage = (uint)(damage * 0.9);
                                                        //}
                                                        //if (attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                        //{
                                                            //damage = (uint)(damage * 0.9);
                                                        //}
                                                        
if (attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                        
//{
                                                            //damage = (uint)(damage * 0.9);
                                                        //}
                                                        
suse.effect attack.effect;
                                                        
attack.damage damage;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attackedsob _obj as msgnpcinfoex;
                                                    if (
attackedsob == null) continue;
                                                    if (!
movein.inrange(attackedsob.xattackedsob.y2ranger)) continue;
                                                    {
                                                        if (!
canattack(attackerattackedsobspell)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                        
attack.damage damage;
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region mortalstrike
                                
case 11990:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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)
                                                {
                                                    if (
_obj == null) continue;
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;

                                                        if (
sector.inside(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedref attackspell);
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                                {
                                                                    
damage = (uint)(damage 1.0);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                                {
                                                                    
damage = (uint)(damage 0.8);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                                {
                                                                    
damage = (uint)(damage 0.6);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                                {
                                                                    
damage = (uint)(damage 0.4);
                                                                }
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            var 
damage calculate.melee(attackerattackedsobref attack);
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedsobattackdamagespell);
                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.px attacker.x;
                                            
attacker.py attacker.y;
                                            
attacker.x;
                                            
attacker.y;
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.owner.screen.reload(suse);
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region leelong
                                #region dragonflow
                                
case 12270:
                                    {
                                        if (
attacker.containsflag3((ulong)msgupdate.flags3.dragonflow))
                                        {
                                            
attacker.removeflag3((ulong)msgupdate.flags3.dragonflow);
                                        }
                                        else
                                        {
                                            
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                            
msgmagiceffect.attacker attacker.uid;
                                            
msgmagiceffect.attacker1 attacker.uid;
                                            
msgmagiceffect.spellid spell.id;
                                            
msgmagiceffect.spelllevel spell.level;
                                            
msgmagiceffect.x;
                                            
msgmagiceffect.y;
                                            
msgmagiceffect.addtarget(attacker.uid1null);
                                            
attacker.owner.sendscreen(msgmagiceffecttrue);
                                            
attacker.addflag3((ulong)msgupdate.flags3.dragonflow);
                                            
attacker.dragonflowstamp time32.now;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region dragonroar
                                
case 12280:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
msgmagiceffect suse = new msgmagiceffect(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 (var 
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.player.uidspell.powernull);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region dragoncyclone
                                
case 12290:
                                    {
                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                        
suse.attacker attacker.uid;
                                        
suse.spellid spell.id;
                                        
suse.spelllevel spell.level;
                                        
suse.x;
                                        
suse.y;
                                        if (
attacker.containsflag((ulong)msgupdate.flags.xplist))
                                        {
                                            
attacker.kocount 0;
                                            
attacker.dragoncyclonetime 40;
                                            
attacker.removeflag((ulong)msgupdate.flags.xplist);
                                            
attacker.addflag3((ulong)msgupdate.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.yydistinlinealgorithm.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.player] && !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.playernull]) 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 player;
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            var 
damage calculate.melee(attackerattackedref attackspell);
                                                            
suse.effect attack.effect;
                                                            
damage = (uint)((damage spell.powerpercent) / 3);
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            var 
damage calculate.melee(attackerattackedref attackspell);
                                                            
suse.effect attack.effect;
                                                            
damage = (uint)(damage 0.4);
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            var 
damage calculate.melee(attackerattackedsobref attack);
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedsobattackdamagespell);
                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
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);
                                            
inlinealgorithm ila = new inlinealgorithm(attacker.xxattacker.yy, (byte)spell.rangeinlinealgorithm.algorithm.dda);
                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                {
                                                    
attacked _obj as player;
                                                    if (
ila.inline(attacked.xattacked.y))
                                                    {
                                                        if (!
canattack(attackerattackedspellattack.interacttype == msginteract.melee)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                        {
                                                            
damage = (uint)(damage 0.7);
                                                        }
                                                        if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                        {
                                                            
damage = (uint)(damage 0.4);
                                                        }
                                                        if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                        {
                                                            
damage = (uint)(damage 0.5);
                                                        }
                                                        if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                        {
                                                            
damage = (uint)(damage 0.3);
                                                        }
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attackedsob _obj as msgnpcinfoex;
                                                    if (
ila.inline(attackedsob.xattackedsob.y))
                                                    {
                                                        if (!
canattack(attackerattackedsobspell)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region airkick
                                
case 12320:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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.yydistinlinealgorithm.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.player]
                                                    && !
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.playernull]) 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 player;
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            var 
damage calculate.melee(attackerattackedref attackspell);
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            var 
damage calculate.melee(attackerattackedref attackspell);
                                                            
damage = (uint)(damage 1.0);
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedattackref damagespell);
                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            
attack.effect msginteract.interacteffects.none;
                                                            var 
damage calculate.melee(attackerattackedsobref attack);
                                                            
suse.effect attack.effect;
                                                            
receiveattack(attackerattackedsobattackdamagespell);
                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
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 & airraid
                                
case 12330:
                                Case 
12340:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
sector.inside(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedref attackspell);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
sector.inside(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedsobref attack);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region speed kick
                                
case 12120:
                                Case 
12130:
                                Case 
12140:
                                    {
                                        
msgmagiceffect suse = new msgmagiceffect(true);
                                        
suse.attacker attacker.uid;
                                        
suse.spellid spell.id;
                                        
suse.spelllevel spell.level;
                                        
suse.x;
                                        
suse.y;
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (
attacked != null)
                                            {
                                                if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.distance)
                                                {
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        
damage = (uint)(damage 1.0);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                else
                                                {
                                                    
attacker.attackpacket null;
                                                }
                                            }
                                            else
                                            {
                                                if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.distance)
                                                {
                                                    if (
canattack(attackerattackedsobspell))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.magic(attackerattackedsobspellref attack);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                            }
                                        }
                                        else
                                        {
                                            
attacker.attackpacket null;
                                        }
                                        
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 (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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) <= spell.distance 1)
                                            {
                                                foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                                {
                                                    if (
_obj == null) continue;
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
sector.isinfan(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedref attackspell);
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                                {
                                                                    
damage = (uint)(damage 0.6);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                                {
                                                                    
damage = (uint)(damage 0.6);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                                {
                                                                    
damage = (uint)(damage 0.6);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                                {
                                                                    
damage = (uint)(damage 0.6);
                                                                }
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
sector.isinfan(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedsobref attack);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region dragon punch
                                
case 12240:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
inlinealgorithm ila = new inlinealgorithm(attacker.xxattacker.yy, (byte)spell.rangeinlinealgorithm.algorithm.dda);
                                            
msgmagiceffect suse = new msgmagiceffect(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.player)
                                                {
                                                    
attacked _obj as player;
                                                    if (
ila.inline(attacked.xattacked.y))
                                                    {
                                                        if (!
canattack(attackerattackedspellattack.interacttype == msginteract.melee)) continue;
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                {
                                                    
attackedsob _obj as msgnpcinfoex;
                                                    if (
canattack(attackerattackedsobspell))
                                                    {
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedsobref attack);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedsobattackdamagespell);
                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region dragonfury
                                
case 12300:
                                    {
                                        if (
attacked != null)
                                        {
                                            if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.distance)
                                            {
                                                if (
canusespell(spellattacker.owner))
                                                {
                                                    
preparespell(spellattacker.owner);
                                                    
msgmagiceffect suse = new msgmagiceffect(true);
                                                    
suse.attacker attacker.uid;
                                                    
suse.spellid spell.id;
                                                    
suse.spelllevel spell.level;
                                                    
suse.x;
                                                    
suse.y;
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage calculate.melee(attackerattackedref attackspell);
                                                        
suse.effect attack.effect;
                                                        
receiveattack(attackerattackedattackref damagespell);
                                                        
suse.addtarget(attacked.uiddamageattack);
                                                        
attacker.owner.player.iseagleeyeshooted true;
                                                        if (
attacked.playerflag == playerflag.player)
                                                            
attacked.owner.sendscreen(susetrue);
                                                        else 
attacked.monsterinfo.sendscreen(suse);
                                                        if (
attacked.playerflag == playerflag.player)
                                                        {
                                                            
int potdifference attacker.battlepower attacked.battlepower;
                                                            
int rate spell.percent potdifference 20;
                                                            if (
kernel.rate(rate))
                                                            {
                                                                
attacked.addflag3((ulong)msgupdate.flags3.dragonfury);
                                                                
attacked.dragonfurystamp time32.now;
                                                                
attacked.dragonfurytime spell.duration;
                                                                
msgupdate upgrade = new msgupdate(true);
                                                                
upgrade.uid attacked.uid;
                                                                
upgrade.append((byte)msgupdate.datatype.dragonfury, (uint)spell.status, (uint)spell.durationspell.powerspell.level);
                                                                
attacker.owner.send(upgrade.toarray());
                                                                if (
attacked.playerflag == playerflag.player)
                                                                    
attacked.owner.send(upgrade);
                                                                else 
attacked.monsterinfo.sendscreen(upgrade);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region dragonswing
                                
case 12200:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                            
msgmagiceffect.attacker attacker.uid;
                                            
msgmagiceffect.spellid spell.id;
                                            
msgmagiceffect.spelllevel spell.level;
                                            
msgmagiceffect.x;
                                            
msgmagiceffect.y;
                                            
attacker.owner.sendscreen(msgmagiceffecttrue);
                                            if (!
attacker.containsflag3((ulong)msgupdate.flags3.dragonswing))
                                            {
                                                
attacker.addflag3((ulong)msgupdate.flags3.dragonswing);
                                                
msgupdate upgrade = new msgupdate(true);
                                                
upgrade.uid attacker.uid;
                                                
upgrade.append((byte)msgupdate.datatype.dragonswing1100000000);
                                                
attacker.owner.send(upgrade.toarray());
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region new tao
                                #region auroralotus
                                
case 12370:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (!
attacker.containsflag3((ulong)msgupdate.flags3.auroralotus)) return;
                                            var 
map attacker.owner.map;
                                            if (!
map.floor[xymapobjecttype.itemnull]) return;
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(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);

                                            
msgmapitem flooritem = new msgmapitem(true);
                                            
flooritem.itemid msgmapitem.auroralotus;
                                            
flooritem.mapid attacker.mapid;
                                            
flooritem.type msgmapitem.effect;
                                            
flooritem.x;
                                            
flooritem.y;
                                            
flooritem.onfloor time32.now;
                                            
flooritem.owner attacker.owner;
                                            
flooritem.uid msgmapitem.flooruid.next;
                                            while (
map.flooritems.containskey(flooritem.uid))
                                                
flooritem.uid msgmapitem.flooruid.next;

                                            
flooritem.maxlife 25;
                                            
flooritem.life 25;
                                            
flooritem.mcolor 13;
                                            
flooritem.owneruid attacker.uid;
                                            
flooritem.ownerguilduid attacker.guildid;
                                            
flooritem.flowertype 0;
                                            
flooritem.time kernel.tqtimer(datetime.now.addseconds(7));
                                            
flooritem.name "auroralotus";
                                            
map.addflooritem(flooritem);
                                            
attacker.owner.sendscreenspawn(flooritemtrue);
                                            
attacker.auroralotusenergy 0;
                                            
attacker.lotus(attacker.auroralotusenergy, (byte)msgupdate.datatype.auroralotus);
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #region flamelotus
                                
case 12380:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (!
attacker.containsflag3((ulong)msgupdate.flags3.flamelotus)) return;
                                            var 
map attacker.owner.map;
                                            if (!
map.floor[xymapobjecttype.itemnull]) return;
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(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);

                                            
msgmapitem flooritem = new msgmapitem(true);
                                            
flooritem.itemid msgmapitem.flamelotus;
                                            
flooritem.mapid attacker.mapid;
                                            
flooritem.type msgmapitem.effect;
                                            
flooritem.x;
                                            
flooritem.y;
                                            
flooritem.onfloor time32.now;
                                            
flooritem.owner attacker.owner;
                                            
flooritem.uid msgmapitem.flooruid.next;
                                            while (
map.flooritems.containskey(flooritem.uid))
                                                
flooritem.uid msgmapitem.flooruid.next;

                                            
flooritem.maxlife 25;
                                            
flooritem.life 25;
                                            
flooritem.mcolor 13;
                                            
flooritem.owneruid attacker.uid;
                                            
flooritem.ownerguilduid attacker.guildid;
                                            
flooritem.flowertype 0;
                                            
flooritem.time kernel.tqtimer(datetime.now.addseconds(7));
                                            
flooritem.name "flamelotus";
                                            
map.addflooritem(flooritem);
                                            
attacker.owner.sendscreenspawn(flooritemtrue);
                                            
attacker.flamelotusenergy 0;
                                            
attacker.lotus(attacker.flamelotusenergy, (byte)msgupdate.datatype.flamelotus);
                                            
attacker.attackpacket null;
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                #region new monk
                                #region upsweep
                                
case 12580://up                               
                                    
{
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            if (
attacked == null)
                                                return;
                                            var 
angle kernel.getangle(attacker.xattacker.yattacked.xattacked.y);
                                            
map.updatecoordonatesforangle(ref xref yangle);

                                            
fan sector = new fan(attacker.xattacker.yxyspell.rangespell.sector);

                                            foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
kernel.getdistance(attacker.xattacker.y_obj.x_obj.y) <= 7)
                                                {
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;

                                                        if (
sector.isinfan(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                                
damage = (uint)(damage 0.5);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;

                                                        if (
sector.isinfan(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);

                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }

                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region downsweep
                                
case 12590://down                                                          
                                    
{
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            if (
attacked == null)
                                                return;
                                            var 
angle kernel.getangle(attacker.xattacker.yattacked.xattacked.y);
                                            
angle enums.oppositeangle(angle);
                                            
map.updatecoordonatesforangle(ref xref yangle);

                                            
fan sector = new fan(attacker.xattacker.yxyspell.rangespell.sector);

                                            foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                            {
                                                if (
_obj == null)
                                                    continue;
                                                if (
kernel.getdistance(attacker.xattacker.y_obj.x_obj.y) <= 7)
                                                {
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;

                                                        if (
sector.isinfan(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                                
damage = (uint)(damage 0.5);
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;

                                                        if (
sector.isinfan(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);

                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }

                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region strike
                                
case 12600:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;

                                            if (
kernel.getdistance(attacker.xattacker.yxy) <= attacker.attackrange 1)
                                            {
                                                if (
attackedsob != null)
                                                {
                                                    if (
canattack(attackerattackedsobspell))
                                                    {
                                                        
preparespell(spellattacker.owner);
                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                        
receiveattack(attackerattackedsobattackdamagespell);

                                                        
suse.addtarget(attackedsob.uiddamageattack);
                                                    }
                                                }
                                                else
                                                {
                                                    if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                    {
                                                        
preparespell(spellattacker.owner);

                                                        
attack.effect msginteract.interacteffects.none;
                                                        
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                        
damage = (uint)(damage 0.5);
                                                        
suse.effect attack.effect;

                                                        
receiveattack(attackerattackedattackref damagespell);

                                                        
suse.addtarget(attacked.uiddamageattack);
                                                    }
                                                }
                                                
attacker.attackpacket null;
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        
attacker.attackpacket null;
                                        break;
                                    }
                                
#endregion
                                #region wrathofemperor
                                
case 12570:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.specialeffect 1;

                                            
suse.x;
                                            
suse.y;


                                            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.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
kernel.getdistance(attacker.xattacker.yattacked.xattacked.y) <= spell.range)
                                                        {
                                                            if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                                                                return;
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
preparespell(spellattacker.owner);

                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attack);
                                                                
suse.effect attack.effect;

                                                                
receiveattack(attackerattackedattackref damagespell);

                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
kernel.getdistance(attacker.xattacker.yattackedsob.xattackedsob.y) <= spell.range)
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
preparespell(spellattacker.owner);
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedsobref attack);
                                                                
receiveattack(attackerattackedsobattackdamagespell);

                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region graceofheaven
                                
case 12560:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
spellid 10425;
                                            
suse.spellid spellid;
                                            
suse.spelllevel attacker.owner.spells[spellid].level;
                                            
suse.x;
                                            
suse.y;
                                            
attacker.attackpacket null;
                                            if (
attacker.owner.team != null)
                                            {

                                                foreach (
client.gamestate teammate in attacker.owner.team.teammates)
                                                {
                                                    
// if (kernel.getdistance(attacker.x, attacker.y, teammate.player.x, teammate.player.y) <= spell.range)
                                                    
{
                                                        if (
teammate.player.containsflag2((ulong)msgupdate.flags2.soulshackle))
                                                        {
                                                            
teammate.player.removeflag2((ulong)msgupdate.flags2.soulshackle);

                                                            
suse.addtarget(teammate.player.uid0attack);

                                                            
msgupdate upgrade = new msgupdate(true);
                                                            
upgrade.uid teammate.player.uid;
                                                            
upgrade.append((byte)msgupdate.datatype.soulshackle
                                                                
111
                                                                
00spell.level);
                                                            if (
teammate.player.playerflag == playerflag.player)
                                                                
teammate.player.owner.send(upgrade.toarray());
                                                        }
                                                    }
                                                }
                                                
attacker.owner.sendscreen(susetrue);

                                            }

                                            {
                                                
suse.addtarget(attacked.uid0attack);

                                                
attacked.toxicfogleft 0;
                                                
attacked.removeflag2((ulong)msgupdate.flags2.soulshackle);

                                                
msgupdate upgrade = new msgupdate(true);
                                                
upgrade.uid attacked.uid;
                                                
upgrade.append((byte)msgupdate.datatype.soulshackle
                                                    
111
                                                    
00spell.level);
                                                if (
attacked.playerflag == playerflag.player)
                                                    
attacked.owner.send(upgrade.toarray());

                                                
attacked.toxicfogleft 0;
                                                
attacked.scurbybomb 0;
                                                
attacked.nodrugstime 0;
                                                
attacked.dragonfurytime 0;
                                                
attacked.flamelayerleft 0;
                                                
//attacked.owner.send(new gamecharacterupdates(true) { uid = attacked.uid, }
                                                //            .remove(gamecharacterupdates.soulshacle));

                                                
attacked.nodrugstime 0;
                                                if (
attacked.playerflag == playerflag.player)
                                                    
attacked.owner.sendscreen(susetrue);
                                                else
                                                    
attacker.owner.sendscreen(susetrue);
                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #region infroecho
                                
case 12550:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            if (!
attacker.epicmonk())
                                                return;

                                            var 
map attacker.owner.map;
                                            if (!
map.floor[xymapobjecttype.itemnull]) return;
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.attacker1 attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.specialeffect 0;
                                            
suse.addtarget(attacker.uid0null);
                                            
attacker.owner.sendscreen(susetrue);

                                            var 
count 3;
                                            if (
spell.level == 6)
                                                
count 4;
                                            list<
system.drawing.pointdestructionareas = new list<system.drawing.point>();
                                            for (
int i 0360+= spell.sector)
                                            {
                                                if (
destructionareas.count >= count)
                                                    break;
                                                
// var dist = kernel.random.next(4);
                                                
var dist kernel.random.next(spell.rangespell.distance);
                                                
//  var angle = kernel.random.next(90);
                                                
var angle i;
                                                
ushort x = (ushort)(+ (dist math.cos(angle)));
                                                
ushort y = (ushort)(+ (dist math.sin(angle)));
                                                
system.drawing.point p = new system.drawing.point((int)x, (int)y);
                                                if (!
destructionareas.contains(p))
                                                    
destructionareas.add(p);
                                                else
                                                    
i--;
                                            }
                                            foreach (var 
area in destructionareas)
                                            {
                                                
= (ushort)area.x;
                                                
= (ushort)area.y;
                                                
msgmapitem flooritem = new msgmapitem(true);
                                                
flooritem.itemid msgmapitem.infroecho;// (uint)(1390 + spell.level);
                                                
flooritem.mapid attacker.mapid;
                                                
flooritem.mcolor 14;
                                                
flooritem.itemcolor = (enums.color.black);
                                                
flooritem.type msgmapitem.effect;
                                                
flooritem.owneruid attacker.uid;
                                                
flooritem.ownerguilduid attacker.guildid;
                                                
flooritem.flowertype 1;
                                                
flooritem.x;
                                                
flooritem.y;
                                                
flooritem.onfloor time32.now;
                                                
flooritem.owner attacker.owner;

                                                
flooritem.name "trap";
                                                while (
map.flooritems.containskey(flooritem.uid))
                                                    
flooritem.uid mr.hamooo.network.gamepackets.msgmapitem.flooruid.next;
                                                
map.addflooritem(flooritem);
                                                
attacker.owner.sendscreenspawn(flooritemtrue);

                                            }
                                        }
                                        break;
                                    }
                                
#endregion
                                #endregion
                                //ahmed nemo 01128547851
                                #region epicwarrior
                                #region maniacdance
                                
case 12700:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);

                                            
msgmagiceffect suse = new msgmagiceffect(true);
                                            
suse.attacker attacker.uid;
                                            
suse.spellid spell.id;
                                            
suse.spelllevel spell.level;
                                            
suse.x;
                                            
suse.y;
                                            
attacker.addflag3((ulong)1ul << 53);
                                            
attacker.maniacdance time32.now;
                                            
attacker.removeflag((ulong)msgupdate.flags.ride);
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region waveofblood
                                
case 12690:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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) <= spell.distance 1)
                                            {
                                                foreach (
interfaces.imapobject _obj in attacker.owner.screen.objects)
                                                {
                                                    if (
_obj == null)
                                                        continue;
                                                    if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;

                                                        if (
sector.isinfan(attacked.xattacked.y))
                                                        {
                                                            if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage game.attacking.calculate.melee(attackerattackedref attackspell);
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                                    if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.king)
                                                                    {
                                                                        
damage = (uint)(damage 0.4);
                                                                    }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.prince)
                                                                {
                                                                    
damage = (uint)(damage 0.4);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.duke)
                                                                {
                                                                    
damage = (uint)(damage 0.4);
                                                                }
                                                                if (
attacker.nobilityrank == game.conquerstructures.nobilityrank.earl)
                                                                {
                                                                    
damage = (uint)(damage 0.4);
                                                                }
                                                                
suse.effect attack.effect;
                                                                
receiveattack(attackerattackedattackref damagespell);
                                                                
suse.addtarget(attacked.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
sector.isinfan(attackedsob.xattackedsob.y))
                                                        {
                                                            if (
canattack(attackerattackedsobspell))
                                                            {
                                                                
attack.effect msginteract.interacteffects.none;
                                                                
uint damage calculate.melee(attackerattackedsobref attack);
                                                                
damage = (uint)(damage 0.9);
                                                                
receiveattack(attackerattackedsobattackdamagespell);
                                                                
suse.addtarget(attackedsob.uiddamageattack);
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                            else
                                            {
                                                
attacker.attackpacket null;
                                            }
                                            
attacker.owner.sendscreen(susetrue);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region pounce
                                
case 12770:
                                    {
                                        if (
canusespell(spellattacker.owner))
                                        {
                                            
preparespell(spellattacker.owner);
                                            
msgmagiceffect suse = new msgmagiceffect(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;
                                            
uint16 oxoy;
                                            
ox attacker.x;
                                            
oy attacker.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.player]
                                                    && !
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.playernull])
                                                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 player;
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            var 
damage game.attacking.calculate.melee(attackerattackedref attackspell);
                                                            
damage = (uint)(damage 1.1);
                                                            
receiveattack(attackerattackedattackref damagespell);

                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.player)
                                                    {
                                                        
attacked _obj as player;
                                                        if (
canattack(attackerattackedspellattack.interacttype == msginteract.melee))
                                                        {
                                                            var 
damage game.attacking.calculate.melee(attackerattackedref attack);
                                                            
damage = (uint)(damage 1.0);
                                                            
receiveattack(attackerattackedattackref damagespell);

                                                            
suse.addtarget(attacked.uiddamageattack);
                                                        }
                                                    }
                                                    else if (
_obj.mapobjtype == mapobjecttype.sobnpc)
                                                    {
                                                        
attackedsob _obj as msgnpcinfoex;
                                                        if (
canattack(attackerattackedsobspell))
                                                        {
                                                            var 
damage game.attacking.calculate.melee(attackerattackedsobref attack);

                                                            
receiveattack(attackerattackedsobattackdamagespell);

                                                            
suse.addtarget(attackedsob.uiddamageattack);
                                                        }
                                                    }
                                                }
                                            }
                                            
attacker.px attacker.x;
                                            
attacker.py attacker.y;
                                            
attacker.x;
                                            
attacker.y;
                                            
attacker.owner.sendscreen(susetrue);
                                            
attacker.owner.screen.reload(suse);
                                        }
                                        break;
                                    }
                                
#endregion
                                #region backfire
                                
case 12680:
                                    {
                                        
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                        
msgmagiceffect.attacker attacker.uid;
                                        
msgmagiceffect.attacker1 attacker.uid;
                                        
msgmagiceffect.spellid spell.id;
                                        
msgmagiceffect.spelllevel spell.level;
                                        
msgmagiceffect.x;
                                        
msgmagiceffect.y;
                                        
msgmagiceffect.addtarget(attacker.uid1attack);
                                        
attacker.owner.sendscreen(msgmagiceffecttrue);
                                        if (
attacker.containsflag3((ulong)1ul << 51))
                                            
attacker.removeflag3((ulong)1ul << 51);
                                        else
                                            
attacker.addflag3((ulong)1ul << 51);
                                        
attacker.backfirestamp time32.now;
                                        break;
                                    }
                                
#endregion
                                #endregion
                                
default:
                                    {
                                        if (
attacker.owner.account.state == accounttable.accountstate.administrator)
                                            
attacker.owner.send("unknown spell id: " spellid);
                                        break;
                                    }
                            }
                            
attacker.owner.increasespellexperience(experiencespellid);
                            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);
                                    if (
xspell != null)
                                    {
                                        if (
attacker.attackpacket == null)
                                        {
                                            
attack.interacttype msginteract.melee;
                                            
attacker.attackpacket attack;
                                        }
                                        else
                                        {
                                            
attacker.attackpacket.interacttype msginteract.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);
                                    if (
xspell == null || spell.id == 9876)
                                        
attacker.attackpacket null;
                                    else
                                    {
                                        if (
attacker.attackpacket == null)
                                        {
                                            
attack.interacttype msginteract.melee;
                                            
attacker.attackpacket attack;
                                        }
                                        else
                                        {
                                            
attacker.attackpacket.interacttype msginteract.melee;
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            
attacker.attackpacket null;
                        }
                    }
                    
#endregion
                
}
                
#endregion
            
}
            
#endregion
        
}
        public static 
bool isarcherskill(uint id)
        {
            if (
id >= 8000 && id <= 9875)
                return 
true;
            return 
false;
        }
        public static 
void quitsteedrace(player attacker)
        {
            
attacker.owner.messagebox("do you want to quit the steed race?", (pclient) =>
            {
                
pclient.player.teleport(1002301279);
                
pclient.player.removeflag((ulong)msgupdate.flags.ride);
            });
        }
        public 
handle(msginteract attackplayer attackerplayer attacked)
        {
            
this.attack attack;
            
this.attacker attacker;
            
this.attacked attacked;
            
this.execute();
        }
        public static list<
ushortgetweaponspell(spellinformation spell)
        {
            return 
spelltable.weaponspells.values.where(=> p.contains(spell.id)).firstordefault();
        }
        public static 
void flamelotus(msgmapitem 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 playerinrange(itemspell.range).toarray();
            
targets targets.where(=> canattack(client.playerp.playernulltrue)).toarray();
            
targets targets.take(count).toarray();
            var 
attack = new msginteract(true);
            
attack.attacker item.owner.player.uid;
            
attack.interacttype msginteract.melee;
            foreach (var 
target in targets)
            {
                
uint damage calculate.magic(client.playertarget.playerspellref 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(msgmapitem 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 playerinrange(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 enums.conqueraction.none;
                    
player.revivestamp time32.now;
                    
player.attackable false;
                    
player.player.transformationid 0;
                    
player.player.removeflag((ulong)msgupdate.flags.dead);
                    
player.player.removeflag((ulong)msgupdate.flags.ghost);
                    
player.player.hitpoints player.player.maxhitpoints;
                    
player.player.ressurect();
                    
player.blesstouch(client);
                }
            }
        }
        public static 
void infroecho(msgmapitem itemint count 0)
        {
            var 
client item.owner;
            var 
item.x;
            var 
item.y;
            if (!
client.spells.containskey(12550))
                return;
            var 
spell spelltable.getspell(client.spells[12550].idclient.spells[12550].level);

            var 
attack = new msginteract(true);
            
attack.attacker client.player.uid;
            
attack.x;
            
attack.y;
            
attack.damage spell.id;
            
attack.interacttype msginteract.magic;


            
msgmagiceffect suse = new msgmagiceffect(true);
            
suse.attacker client.player.uid;
            
suse.spellid spell.id;
            
suse.spelllevel spell.level;
            
suse.x;
            
suse.y;
            
suse.specialeffect 1;
            foreach (var 
c in client.screen.objects)
            {

                
interfaces.imapobject _obj as player;
                if (
_obj == null)
                    continue;
                if (
_obj.mapobjtype == mapobjecttype.monster || _obj.mapobjtype == mapobjecttype.player)
                {
                    var 
attacked _obj as player;
                    if (
kernel.getdistance(xyattacked.xattacked.y) <= spell.range)
                    {
                        if (
canattack(client.playerattackedspellattack.interacttype == msginteract.ranged))
                        {
                            
uint damage game.attacking.calculate.melee(client.playerattackedref attack);
                            
damage = (uint)(damage 0.2);
                            
suse.effect attack.effect;
                            
receiveattack(client.playerattackedattackref damagespell);
                            
attacked.stunned true;
                            
attacked.stunstamp time32.now;
                            
suse.addtarget(attacked.uiddamageattack);

                        }
                    }
                }
            }
            
client.player.attackpacket null;
            
client.sendscreen(susetrue);
        }
        public static 
void handleauramonk(player attackerspellinformation spell)
        {
            
ulong statusflag 0statusflag2 0;
            
enums.auratype aura enums.auratype.tyrantaura;
            switch (
spell.id)
            {
                case 
10424Statusflag = (ulong)msgupdate.flags2.earthaura; break;
                case 
10423Statusflag = (ulong)msgupdate.flags2.fireaura; break;
                case 
10422Statusflag = (ulong)msgupdate.flags2.wateraura; break;
                case 
10421Statusflag = (ulong)msgupdate.flags2.woodaura; break;
                case 
10420Statusflag = (ulong)msgupdate.flags2.metalaura; break;
                case 
10410Statusflag = (ulong)msgupdate.flags2.fendaura; break;
                case 
10395Statusflag = (ulong)msgupdate.flags2.tyrantaura; break;
            }
            switch (
spell.id)
            {
                case 
10424Statusflag2 = (ulong)msgupdate.flags2.earthauraicon; break;
                case 
10423Statusflag2 = (ulong)msgupdate.flags2.fireauraicon; break;
                case 
10422Statusflag2 = (ulong)msgupdate.flags2.waterauraicon; break;
                case 
10421Statusflag2 = (ulong)msgupdate.flags2.woodauraicon; break;
                case 
10420Statusflag2 = (ulong)msgupdate.flags2.metalauraicon; break;
                case 
10410Statusflag2 = (ulong)msgupdate.flags2.fendauraicon; break;
                case 
10395Statusflag2 = (ulong)msgupdate.flags2.tyrantauraicon; break;
            }
            if (
attacker.dead) return;
            if (
attacker.aura_isactive)
            {
                switch (
attacker.aura_acttype)
                {
                    case 
10424Aura enums.auratype.earthaura; break;
                    case 
10423Aura enums.auratype.fireaura; break;
                    case 
10422Aura enums.auratype.wateraura; break;
                    case 
10421Aura enums.auratype.woodaura; break;
                    case 
10420Aura enums.auratype.metalaura; break;
                    case 
10410Aura enums.auratype.fendaura; break;
                    case 
10395Aura enums.auratype.tyrantaura; break;
                }
                new 
msgupdate(true).aura(attackerenums.auradatatypes.removeauraspell);
                
attacker.removeflag2(attacker.aura_acttype);
                
attacker.removeflag2(attacker.aura_acttype2);
                
attacker.owner.removeaurabonuses(attacker.aura_acttypeattacker.aura_actpower1);
                
attacker.aura_isactive false;
                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 enums.auratype.earthaura; break;
                        case 
10423Aura enums.auratype.fireaura; break;
                        case 
10422Aura enums.auratype.wateraura; break;
                        case 
10421Aura enums.auratype.woodaura; break;
                        case 
10420Aura enums.auratype.metalaura; break;
                        case 
10410Aura enums.auratype.fendaura; break;
                        case 
10395Aura enums.auratype.tyrantaura; break;
                    }
                    new 
msgupdate(true).aura(attackerenums.auradatatypes.removeauraspell);
                    
attacker.removeflag2(attacker.aura_acttype);
                    
attacker.removeflag2(attacker.aura_acttype2);
                    
attacker.owner.removeaurabonuses(attacker.aura_acttypeattacker.aura_actpower1);
                    
attacker.aura_isactive false;
                    if (
statusflag == attacker.aura_acttype)
                    {
                        
attacker.aura_acttype2 0;
                        
attacker.aura_acttype 0;
                        
attacker.aura_actpower 0;
                        
attacker.aura_actlevel 0;
                    }
                }
                if (
spell.power == 0)
                    
spell.power 45;
                
preparespell(spellattacker.owner);
                
msgmagiceffect suse = new msgmagiceffect(true);
                
suse.attacker attacker.uid;
                
suse.spellid spell.id;
                
suse.spelllevel spell.level;
                
suse.attacker.x;
                
suse.attacker.y;
                
suse.addtarget(attacker.uid0null);
                
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 enums.auratype.earthaura; break;
                    case 
10423Aura enums.auratype.fireaura; break;
                    case 
10422Aura enums.auratype.wateraura; break;
                    case 
10421Aura enums.auratype.woodaura; break;
                    case 
10420Aura enums.auratype.metalaura; break;
                    case 
10410Aura enums.auratype.fendaura; break;
                    case 
10395Aura enums.auratype.tyrantaura; break;
                }
                new 
msgupdate(true).aura(attackerenums.auradatatypes.addauraspell);
            }
        }

        public static 
void lotusattack(msgmapitem itemplayer attackermsginteract attack)
        {
            
//console.writeline("for test");
        
}
        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 
ienumerable<client.gamestateplayerinrange(player attackerplayer attacked)
        {
            var 
dictionary kernel.gamepool.values.toarray();

            return 
dictionary.where((player) => player.player.mapid == attacked.mapid && kernel.getdistance(player.player.xplayer.player.yattacker.xattacker.y) <= 7);
        }
        public static 
ienumerable<client.gamestateplayerinrange(msgmapitem itemint dist)
        {
            var 
dictionary kernel.gamepool.values.toarray();
            return 
dictionary.where((player) => player.player.mapid == item.mapid && kernel.getdistance(player.player.xplayer.player.yitem.xitem.y) <= dist).orderby(player => kernel.getdistance(player.player.xplayer.player.yitem.xitem.y));
        }
        public 
player findclosesttarget(player attackerushort xushort yienumerable<interfaces.imapobject> array)
        {
            
player closest attacker;
            
int dprev 10000dist 0;
            foreach (var 
_obj in array)
            {
                if (
_obj == null) continue;
                if (
_obj.mapobjtype != mapobjecttype.player && _obj.mapobjtype != mapobjecttype.monster) continue;
                
dist kernel.getdistance(xy_obj.x_obj.y);
                if (
dist dprev)
                {
                    
dprev dist;
                    
closest = (player)_obj;
                }
            }
            return 
closest;
        }

        public static 
bool canusespell(spellinformation spellclient.gamestate client)
        {
            if (
client.player.skillteamwatchingelitepkmatch != null) return false;
            if (
client.watchingelitepkmatch != null) return false;
            if (
client.watchinggroup != null) return false;
            if (
client.teamwatchinggroup != 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 (
client.player.mapid == 1707)
            {
                if (
spell.id != 1045 && spell.id != 1046)
                {
                    
client.send("you can't use any skills here except fb and ss!"); return false;
                }
            }
            if (
spell.usearrows && isarcherskill(spell.id))
            {
                var 
weapons client.weapons;
                if (
weapons.item2 != null)
                    if (!
client.player.containsflag3((ulong)msgupdate.flags3.pathofshadow))
                        if (!
itemhandler.isarrow(weapons.item2.id)) return false;
                return 
true;
            }
            if (
spell.needxp == && !client.player.containsflag((ulong)msgupdate.flags.xplist)) return false;
            return 
true;
        }
        public static 
void preparespell(spellinformation spellclient.gamestate client)
        {
            if (
spell.needxp == 1)
                
client.player.removeflag((ulong)msgupdate.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 
void checkforextraweaponpowers(client.gamestate clientplayer 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:
                                    {
                                        
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                        
msgmagiceffect.attacker 1;
                                        
msgmagiceffect.spellid 1175;
                                        
msgmagiceffect.spelllevel 4;
                                        
msgmagiceffect.client.player.x;
                                        
msgmagiceffect.client.player.y;
                                        
msgmagiceffect.addtarget(client.player.uid300null);
                                        
uint damage math.min(300client.player.maxhitpoints client.player.hitpoints);
                                        
client.player.hitpoints += damage;
                                        
client.sendscreen(msgmagiceffecttrue);
                                        break;
                                    }
                                case 
enums.itemeffect.mp:
                                    {
                                        
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                        
msgmagiceffect.attacker 1;
                                        
msgmagiceffect.spellid 1175;
                                        
msgmagiceffect.spelllevel 2;
                                        
msgmagiceffect.client.player.x;
                                        
msgmagiceffect.client.player.y;
                                        
msgmagiceffect.addtarget(client.player.uid300null);
                                        
ushort damage = (ushort)math.min(300client.player.maxmana client.player.mana);
                                        
client.player.mana += damage;
                                        
client.sendscreen(msgmagiceffecttrue);
                                        break;
                                    }
                                case 
enums.itemeffect.shield:
                                    {
                                        if (
client.player.containsflag((ulong)msgupdate.flags.magicshield)) return;
                                        
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                        
msgmagiceffect.attacker 1;
                                        
msgmagiceffect.spellid 1020;
                                        
msgmagiceffect.spelllevel 0;
                                        
msgmagiceffect.client.player.x;
                                        
msgmagiceffect.client.player.y;
                                        
msgmagiceffect.addtarget(client.player.uid120null);
                                        
client.player.shieldtime 0;
                                        
client.player.shieldstamp time32.now;
                                        
client.player.magicshieldstamp time32.now;
                                        
client.player.magicshieldtime 0;
                                        
client.player.addflag((ulong)msgupdate.flags.magicshield);
                                        
client.player.magicshieldstamp time32.now;
                                        
client.player.magicshieldincrease 2;
                                        
client.player.magicshieldtime 120;
                                        if (
client.player.playerflag == playerflag.player)
                                            
client.send(constants.shield(2120));
                                        
client.sendscreen(msgmagiceffecttrue);
                                        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;
                                            
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                            
msgmagiceffect.spellid 5040;
                                            
msgmagiceffect.attacker attacked.uid;
                                            
msgmagiceffect.spelllevel 9;
                                            
msgmagiceffect.attacked.x;
                                            
msgmagiceffect.attacked.y;
                                            
msgmagiceffect.addtarget(attacked.uid0null);
                                            
msgmagiceffect.targets[attacked.uid].hit true;
                                            
attacked.toxicfogstamp time32.now;
                                            
attacked.toxicfogleft 10;
                                            
attacked.toxicfogpercent 0.05f;
                                            
client.sendscreen(msgmagiceffecttrue);
                                        }
                                        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:
                                    {
                                        
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                        
msgmagiceffect.attacker 1;
                                        
msgmagiceffect.spellid 1175;
                                        
msgmagiceffect.spelllevel 4;
                                        
msgmagiceffect.client.player.x;
                                        
msgmagiceffect.client.player.y;
                                        
msgmagiceffect.addtarget(client.player.uid300null);
                                        
uint damage math.min(300client.player.maxhitpoints client.player.hitpoints);
                                        
client.player.hitpoints += damage;
                                        
client.sendscreen(msgmagiceffecttrue);
                                        break;
                                    }
                                case 
enums.itemeffect.mp:
                                    {
                                        
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                        
msgmagiceffect.attacker 1;
                                        
msgmagiceffect.spellid 1175;
                                        
msgmagiceffect.spelllevel 2;
                                        
msgmagiceffect.client.player.x;
                                        
msgmagiceffect.client.player.y;
                                        
msgmagiceffect.addtarget(client.player.uid300null);
                                        
ushort damage = (ushort)math.min(300client.player.maxmana client.player.mana);
                                        
client.player.mana += damage;
                                        
client.sendscreen(msgmagiceffecttrue);
                                        break;
                                    }
                                case 
enums.itemeffect.shield:
                                    {
                                        if (
client.player.containsflag((ulong)msgupdate.flags.magicshield))
                                            return;
                                        
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                        
msgmagiceffect.attacker 1;
                                        
msgmagiceffect.spellid 1020;
                                        
msgmagiceffect.spelllevel 0;
                                        
msgmagiceffect.client.player.x;
                                        
msgmagiceffect.client.player.y;
                                        
msgmagiceffect.addtarget(client.player.uid120null);
                                        
client.player.shieldtime 0;
                                        
client.player.shieldstamp time32.now;
                                        
client.player.magicshieldstamp time32.now;
                                        
client.player.magicshieldtime 0;

                                        
client.player.addflag((ulong)msgupdate.flags.magicshield);
                                        
client.player.magicshieldstamp time32.now;
                                        
client.player.magicshieldincrease 2;
                                        
client.player.magicshieldtime 120;
                                        if (
client.player.playerflag == playerflag.player)
                                            
client.send(constants.shield(2120));
                                        
client.sendscreen(msgmagiceffecttrue);
                                        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;
                                            
msgmagiceffect msgmagiceffect = new msgmagiceffect(true);
                                            
msgmagiceffect.spellid 5040;
                                            
msgmagiceffect.attacker attacked.uid;
                                            
msgmagiceffect.spelllevel 9;
                                            
msgmagiceffect.attacked.x;
                                            
msgmagiceffect.attacked.y;
                                            
msgmagiceffect.addtarget(attacked.uid0null);
                                            
msgmagiceffect.targets[attacked.uid].hit true;
                                            
attacked.toxicfogstamp time32.now;
                                            
attacked.toxicfogleft 10;
                                            
attacked.toxicfogpercent 0.05f;
                                            
client.sendscreen(msgmagiceffecttrue);
                                        }
                                        break;
                                    }
                            }
                        }
                    }
                }
            }
            
#endregion
        
}

        public static 
bool canattack(player attackermsgnpcinfoex attackedspellinformation spell)
        {
            if (
attacker.mapid == 2292)
            {
                if (((
attacker.guildid == 0) || !polapk.iswar) && (attacked.uid == 1235))
                {
                    return 
false;
                }
                if (
polapk.polekeeper != null)
                {
                    if (
polapk.polekeeper == attacker.owner.guild)
                    {
                        if (
attacked.uid == 1235)
                        {
                            return 
false;
                        }
                    }
                    else if ((((
attacked.uid == 0x7dfeb) || (attacked.uid == 0x7dfea)) && (polapk.polekeeper == attacker.owner.guild)) && (attacker.pkmode == enums.pkmode.team))
                    {
                        return 
false;
                    }
                }
            }
            
            if (
attacker.mapid == 2291)
            {
                if (((
attacker.guildid == 0) || !polapk2.iswar) && (attacked.uid == 1325))
                {
                    return 
false;
                }
                if (
polapk2.polekeeper != null)
                {
                    if (
polapk2.polekeeper == attacker.owner.guild)
                    {
                        if (
attacked.uid == 1325)
                        {
                            return 
false;
                        }
                    }
                    else if ((((
attacked.uid == 0x7dfeb) || (attacked.uid == 0x7dfea)) && (polapk2.polekeeper == attacker.owner.guild)) && (attacker.pkmode == enums.pkmode.team))
                    {
                        return 
false;
                    }
                }
            }
            if (
attacker.mapid == 2293)
            {
                if (((
attacker.guildid == 0) || !polapk3.iswar) && (attacked.uid == 817))
                {
                    return 
false;
                }
                if (
polapk3.polekeeper != null)
                {
                    if (
polapk3.polekeeper == attacker.owner.guild)
                    {
                        if (
attacked.uid == 817)
                        {
                            return 
false;
                        }
                    }
                    else if ((((
attacked.uid == 0x7dfeb) || (attacked.uid == 0x7dfea)) && (polapk3.polekeeper == attacker.owner.guild)) && (attacker.pkmode == enums.pkmode.team))
                    {
                        return 
false;
                    }
                }
            }
            if (
attacker.mapid == 2294)
            {
                if (((
attacker.guildid == 0) || !polapk4.iswar) && (attacked.uid == 23120))
                {
                    return 
false;
                }
                if (
polapk4.polekeeper != null)
                {
                    if (
polapk4.polekeeper == attacker.owner.guild)
                    {
                        if (
attacked.uid == 23120)
                        {
                            return 
false;
                        }
                    }
                    else if ((((
attacked.uid == 0x7dfeb) || (attacked.uid == 0x7dfea)) && (polapk4.polekeeper == attacker.owner.guild)) && (attacker.pkmode == enums.pkmode.team))
                    {
                        return 
false;
                    }
                }
            }

            
#region guildpolewar
            
if (guildpolewar.iswar)
            {
                if (
attacker.mapid == guildpolewar.map.id)
                {
                    return 
guildpolewar.attack(0attackerattacked);
                }
            }
            
#endregion
            #region classpolewar
            //if (msgserver.game.classpolewar.iswar)
            //{
            //    if (attacker.mapid == msgserver.game.classpolewar.map.id)
            //    {
            //        return msgserver.game.classpolewar.attack(0, attacker, attacked);
            //    }
            //}
            #endregion
            #region clanwar
            
if (attacker.mapid == 1509)
            {
                if (
attacker.clanid == || !clanwar.iswar)
                {
                    if (
attacked.uid == 813)
                    {
                        return 
false;
                    }
                }
                if (
clanwar.polekeeper != null)
                {
                    if (
clanwar.polekeeper == attacker.getclan)
                    {
                        if (
attacked.uid == 813)
                        {
                            return 
false;
                        }
                    }
                }
            }
            
#endregion
            #region eliteguildwar
            
if (attacker.mapid == 2071)
            {
                if (
attacker.guildid == || !eliteguildwar.iswar)
                {
                    if (
attacked.uid == 812)
                    {
                        return 
false;
                    }
                }
                if (
eliteguildwar.polekeeper != null)
                {
                    if (
eliteguildwar.polekeeper == attacker.owner.guild)
                    {
                        if (
attacked.uid == 812)
                        {
                            return 
false;
                        }
                    }
                    else if (
attacked.uid == 516075 || attacked.uid == 516074)
                    {
                        if (
eliteguildwar.polekeeper == attacker.owner.guild)
                        {
                            if (
attacker.pkmode == enums.pkmode.team)
                                return 
false;
                        }
                    }
                }
            }
            
#endregion
            #region statuewar
            
if (statueswar.iswar)
            {
                if (
attacker.mapid == statueswar.map.id)
                {
                    if (
attacker.guildid == || !statueswar.iswar)
                        if (
attacked.uid == statueswar.pole.uid)
                            return 
false;
                    if (
statueswar.polekeeper != null)
                    {
                        if (
statueswar.polekeeper == attacker.owner.asmember)
                            if (
attacked.uid == statueswar.pole.uid)
                                return 
false;
                        if (
statueswar.polekeeper == attacker.owner.asmember)
                            if (
attacker.pkmode == enums.pkmode.team)
                                return 
false;

                    }
                }
            }
            
#endregion
            #region poleemulator
            
if (attacked.uid == 123456)
                if (
attacked.hitpoints 0)
                    if (
attacker.guildid != && attacker.guildid != server.thread.poleemulator.killerguildid)
                        return 
true;
                    else return 
false;
                else return 
false;
            
#endregion
            #region guildwar
            
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;
                        }
                    }
                }
            }
            
#endregion
            #region superguildwar
            
if (attacker.mapid == 1234)
            {
                if (
attacker.guildid == || !game.superguildwar.iswar)
                {
                    if (
attacked.uid == 811) return false;
                }
                if (
game.superguildwar.polekeeper != null)
                {
                    if (
game.superguildwar.polekeeper == attacker.owner.guild)
                    {
                        if (
attacked.uid == 811) return false;
                    }
                    else if (
attacked.uid == 516077 || attacked.uid == 516076)
                    {
                        if (
game.superguildwar.polekeeper == attacker.owner.guild)
                        {
                            if (
attacker.pkmode == enums.pkmode.team) return false;
                        }
                    }
                }
            }
            
#endregion
            #region crow
            
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;
                }
            }
            
#endregion
            #region can't attack npc
            
if (attacked.uid == 76112 || attacked.uid == 127123 || attacked.uid == 141198 || attacked.uid == 9683 || attacked.uid == 2015 || attacked.uid == 20140
                
|| attacked.uid == 9884 || attacked.uid == 9885 || attacked.uid == 9886 || attacked.uid == 9887
                
|| attacked.uid == 9994 || attacked.uid == 9995 || attacked.uid == 9996 || attacked.uid == 9997 || attacked.uid == 41162
                
|| attacked.uid == 180 || attacked.uid == 181 || attacked.uid == 182 || attacked.uid == 183 || attacked.uid == 801
                
|| attacked.uid == 184 || attacked.uid == 185 || attacked.uid == 7882 || attacked.uid == 1232 || attacked.uid == 16416 || attacked.uid == 16417
                
|| attacked.uid == 216341 || attacked.uid == 1231 || attacked.uid == 6567 || attacked.uid == 4132 || attacked.uid == 64132 || attacked.uid == 44821)
            {
                
attacker.attackpacket null;
                return 
false;
            }
            
#endregion
            
return true;
        }
        public static 
bool canattack(player attackerplayer attackedspellinformation spellbool melee)
        {
            
#region thundercloud
            
if (attacker.name == "thundercloud")
            {
                if (
attacker.pkmode != game.enums.pkmode.pk &&
                         
attacker.pkmode != game.enums.pkmode.team)
                    return 
false;
            }

            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((ulong)network.gamepackets.msgupdate.flags.flashingname);
                        
attacker.flashingnamestamp time32.now;
                        
attacker.flashingnametime 20;

                        return 
true;
                    }
                }
                else return 
false;
            }
            
#endregion
            
if (attacker.containsflag4((ulong)msgupdate.flags4.xchillingsnow))
                return 
false;
            
#region kongfu
            
if (attacker.playerflag == playerflag.player && attacked.playerflag == playerflag.player)
            {
                if (
attacker.pkmode == enums.pkmode.kongfu && attacker.kongfuactive == true && attacked.pkmode != enums.pkmode.kongfu && attacked.kongfuactive == false && !attacked.containsflag((ulong)msgupdate.flags.flashingname) && !attacked.containsflag((ulong)msgupdate.flags.blackname))
                {
                    if (
attacked.dead) return false;
                    
attacker.owner.send(new msgtalk("you can only attack fighters of the jiang hu while in the jiang hu"msgtalk.topleft));
                    return 
false;
                }
                else if (
attacker.pkmode == enums.pkmode.kongfu && attacker.kongfuactive == true)
                {
                    if (
attacked.pkmode == enums.pkmode.kongfu || attacked.kongfuactive == true || attacked.containsflag((ulong)msgupdate.flags.flashingname) || attacked.containsflag((ulong)msgupdate.flags.blackname))
                    {
                        if (
attacked.dead) return false;
                        if (
attacker.mapid == 1002 || attacker.mapid == 1000 || attacker.mapid == 1015 || attacker.mapid == 1020 || attacker.mapid == 1011 || attacker.mapid == 3055)
                        {
                            try
                            {
                                if (
attacker.settings != msgownkongfupksetting.settings.none)
                                {
                                    if ((
attacker.settings msgownkongfupksetting.settings.nothitfriends) == msgownkongfupksetting.settings.nothitfriends)
                                    {
                                        if (
attacker.owner.friends.containskey(attacked.uid))
                                            return 
false;
                                    }
                                    if ((
attacker.settings msgownkongfupksetting.settings.nohitalliesclan) == msgownkongfupksetting.settings.nohitalliesclan)
                                    {
                                        var 
attacker_clan attacker.getclan;
                                        if (
attacker_clan != null)
                                        {
                                            if (
attacker_clan.allies.containskey(attacked.clanid))
                                                return 
false;
                                        }
                                    }
                                    if ((
attacker.settings msgownkongfupksetting.settings.nothitalliedguild) == msgownkongfupksetting.settings.nothitalliedguild)
                                    {
                                        if (
attacker.owner.guild != null)
                                        {
                                            if (
attacker.owner.guild.ally.containskey(attacked.guildid))
                                                return 
false;
                                        }
                                    }
                                    if ((
attacker.settings msgownkongfupksetting.settings.nothitclanmembers) == msgownkongfupksetting.settings.nothitclanmembers)
                                    {
                                        if (
attacker.clanid == attacked.clanid)
                                            return 
false;
                                    }
                                    if ((
attacker.settings msgownkongfupksetting.settings.nothitguildmembers) == msgownkongfupksetting.settings.nothitguildmembers)
                                    {
                                        if (
attacker.guildid == attacked.guildid)
                                            return 
false;
                                    }
                                }
                            }
                            catch (
exception e)
                            {
                                
console.writeline(e.tostring());
                            }
                            return 
true;
                        }
                    }
                    return 
false;
                }
            }
            
#endregion
            #region factionwar
            
if (attacker.onpiratefaction == true && attacked.onninjafaction == true || attacker.onninjafaction == true && attacked.onpiratefaction == true)
            {
                if (
attacked.dead) return false;
                if (
attacker.mapid == 1002 || attacker.mapid == 1000 || attacker.mapid == 1015 || attacker.mapid == 1020 || attacker.mapid == 1011 || attacker.mapid == 3055)
                {
                    return 
true;
                }
                return 
false;
            }
            
#endregion
            
if (attacker.mapid == 1507)
            {
                if (!
attacker.allowtoattack)
                    return 
false;
            }
            if (
attacked.playerflag == playerflag.monster)
            {
                if (
attacked.companion)
                {
                    if (
attacked.owner == attacker.owner) return false;
                }
            }
            if (
attacker.timerinportchampion.addseconds(10) > datetime.now)
                return 
false;
            if (
attacker.uid == attacked.uid)
                return 
false;
            if (
attacker.pkmode == enums.pkmode.guild)
            {
                if (
attacker.owner.guild.enemy.containskey(attacked.guildid))
                {
                    if (
attacked.dead) return false;
                    if (
attacker.uid == attacked.uid) return false;
                    if (
attacker.mapid == 1000 || attacker.mapid == 1015 || attacker.mapid == 1020 || attacker.mapid == 1011)
                    {
                        
attacker.addflag((ulong)msgupdate.flags.flashingname);
                        
attacker.flashingnamestamp time32.now;
                        
attacker.flashingnametime 10;
                        return 
true;
                    }
                }
            }
            if (
attacker.pkmode == enums.pkmode.revenge)
            {
                if (
attacker.owner.enemy.containskey(attacked.uid))
                {
                    if (
attacked.dead) return false;
                    if (
attacker.uid == attacked.uid) return false;
                    if (
attacker.mapid == 1000 || attacker.mapid == 1015 || attacker.mapid == 1020 || attacker.mapid == 1011)
                    {
                        
attacker.addflag((ulong)msgupdate.flags.flashingname);
                        
attacker.flashingnamestamp time32.now;
                        
attacker.flashingnametime 10;
                        return 
true;
                    }
                }
            }
            if (
attacked.playerflag == playerflag.monster)
            {
                if (
attacked.monsterinfo.id == monsterinformation.reviverid)
                    return 
false;
            }
            if (
attacked.dead)
            {
                return 
false;
            }
            if (
attacker.playerflag == playerflag.player && attacker.owner.watchingelitepkmatch != null)
            {
                return 
false;
            }
            if (
attacked.playerflag == playerflag.player && attacked.owner.watchingelitepkmatch != null)
            {
                return 
false;
            }
            if (
attacker.playerflag == playerflag.player)
            {
                if (
attacked != null && attacked.playerflag == playerflag.player)
                    if (
attacker.owner.inteamqualifier() && attacked.owner.inteamqualifier())
                        return !
attacker.owner.team.isteammate(attacked.uid);
            }
            if (
spell != null)
                if (
attacker.playerflag == playerflag.player)
                    if (
attacker.owner.watchinggroup != null)
                        return 
false;
            if (
attacked == null)
            {
                return 
false;
            }
            if (
attacker.skillteamwatchingelitepkmatch != null)
            {
                return 
false;
            }
            if (
attacked.dead)
            {
                
attacker.attackpacket null;
                return 
false;
            }
            if (
attacker.playerflag == playerflag.player && attacked.playerflag == playerflag.player && attacked.owner.team != null && attacker.owner.team != null && attacker.owner.team.elitefighterstats != null && attacked.owner.team.elitefighterstats != null && attacker.mapid == attacked.owner.team.elitematch.map.id && attacker.owner.team.elitematch != null)
            {
                return 
attacker.owner.team != attacked.owner.team;
            }
            if (
attacker.playerflag == playerflag.player && attacked.playerflag == playerflag.player)
                if ((
attacker.owner.inqualifier() && attacked.owner.iswatching()) || (attacked.owner.inqualifier() && attacker.owner.iswatching()))
                    return 
false;
            if (
attacker.playerflag == playerflag.player)
                if (
time32.now attacker.owner.cantattack)
                    return 
false;
            if (
attacked.playerflag == playerflag.monster)
            {
                if (
attacked.companion)
                {
                    if (
constants.pkforbiddenmaps.contains(attacker.owner.map.id))
                    {
                        if (
attacked.owner == attacker.owner) return false;
                        if (
attacker.pkmode != enums.pkmode.pk && attacker.pkmode != enums.pkmode.team) return false;
                        else
                        {
                            
attacker.addflag((ulong)msgupdate.flags.flashingname);
                            
attacker.flashingnamestamp time32.now;
                            
attacker.flashingnametime 10;
                            return 
true;
                        }
                    }
                }
                if (
attacked.name.contains("guard1"))
                {
                    if (
attacker.pkmode != enums.pkmode.pk && attacker.pkmode != game.enums.pkmode.team) return false;
                    else
                    {
                        
attacker.addflag((ulong)msgupdate.flags.flashingname);
                        
attacker.flashingnamestamp time32.now;
                        
attacker.flashingnametime 10;
                        return 
true;
                    }
                }
                else return 
true;
            }
            else
            {
                if (
attacked.playerflag == playerflag.player)
                    if (!
attacked.owner.attackable)
                        return 
false;
                if (
attacker.playerflag == playerflag.player)
                    if (
attacker.owner.watchinggroup == null)
                        if (
attacked.playerflag == playerflag.player)
                            if (
attacked.owner.watchinggroup != null)
                                return 
false;
                if (
spell != null)
                {
                    if (
spell.id != 8001)
                    {
                        if (
spell.onlyground)
                            if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                                return 
false;
                        if (
melee && attacked.containsflag((ulong)msgupdate.flags.fly))
                            return 
false;
                    }
                }
                if (
spell != null)
                {
                    if (
spell.id == 6010)
                    {
                        if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                            return 
false;
                    }
                }
                if (
spell != null)
                {
                    if (
spell.id == 10381)
                    {
                        if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                            return 
false;
                    }
                }
                if (
spell != null)
                {
                    if (
spell.id == 6000)
                    {
                        if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                            return 
false;
                    }
                }
                if (
spell != null)
                {
                    if (
spell.id == 5030)
                    {
                        if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                            return 
false;
                    }
                }
                if (
spell == null)
                {
                    if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                        return 
false;
                }
                if (
constants.pkforbiddenmaps.contains(attacker.owner.map.id))
                {
                    if (((
attacker.pkmode == enums.pkmode.pk) || (attacker.pkmode == enums.pkmode.team)) || ((spell != null) && spell.cankill))
                    {
                        
attacker.owner.send(constants.pkforbidden);
                        
attacker.attackpacket null;
                    }
                    return 
false;
                }
                if (
attacker.pkmode == enums.pkmode.capture)
                {
                    if (
attacked.containsflag((ulong)msgupdate.flags.flashingname) || attacked.pkpoints 99)
                    {
                        return 
true;
                    }
                }
                if (
attacker.pkmode == enums.pkmode.peace)
                {
                    return 
false;
                }
                if (
attacker.uid == attacked.uid)
                    return 
false;
                if (
attacker.pkmode == enums.pkmode.team)
                {
                    if (
attacker.owner.team != null)
                    {
                        if (
attacker.owner.team.isteammate(attacked.uid))
                        {
                            
attacker.attackpacket null;
                            return 
false;
                        }
                    }
                    if (
attacker.pkmode == enums.pkmode.team)
                    {
                        if (
attacker.owner.team != null)
                        {
                            if (!
attacker.owner.team.isteammate(attacked.uid))
                            {
                                if (
attacker.inskillpk == true)
                                {
                                    return 
true;
                                }
                            }
                        }
                    }
                    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.containskey(attacked.guildid))
                        {
                            
attacker.attackpacket null;
                            return 
false;
                        }
                    }
                    if (
attacker.clanid != 0)
                    {
                        if (
attacker.getclan.allies.containskey(attacked.clanid))
                        {
                            
attacker.attackpacket null;
                            return 
false;
                        }
                    }
                }
                if (
spell != null)
                    if (
spell.onlyground)
                        if (
attacked.containsflag((ulong)msgupdate.flags.fly))
                            return 
false;

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

                if (
attacker.pkmode != enums.pkmode.pk &&
                    
attacker.pkmode != enums.pkmode.team && attacked.pkpoints 99)
                {
                    
attacker.attackpacket null;
                    return 
false;
                }
                else
                {
                    if (!
attacked.containsflag((ulong)msgupdate.flags.flashingname))
                    {
                        if (!
attacked.containsflag((ulong)msgupdate.flags.blackname))
                        {
                            if (
constants.pkfreemaps.contains(attacker.mapid)) return true;
                            if (
attacker.owner.map.baseid == 700) return true;
                            
attacker.addflag((ulong)msgupdate.flags.flashingname);
                            
attacker.flashingnamestamp time32.now;
                            
attacker.flashingnametime 10;
                        }
                    }
                    return 
true;
                }
            }
        }

        public static 
void receiveattack(player attackerplayer attackedmsginteract attackref uint damagespellinformation spell)
        {
            
#region statueswar
            
if (statueswar.iswar)
            {
                if (
attacker.mapid == statueswar.map.id)
                {
                    if (
attacked.uid == statueswar.pole.uid)
                    {
                        if (
statueswar.polekeeper == attacker.owner.asmember)
                            return;
                        if (
attacked.hitpoints <= damage)
                            
attacked.hitpoints 0;
                        
statueswar.addscore(damageattacker.owner.asmember);
                    }
                }
            }
            
#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.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
            #region revengetaill
            
if (attacked.containsflag4((ulong)network.gamepackets.msgupdate.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)
                    {
                        
msgmagiceffect suses = new msgmagiceffect(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 chillingsnow
            
if (attacked.containsflag4((ulong)msgupdate.flags4.chillingsnow) && attacked.isstomper2() && attacker.playerflag == playerflag.player)
            {
                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((ulong)msgupdate.flags4.xchillingsnow);
                    
attacker.chillingsnowstamp time32.now;
                    
attacker.chillingsnow = (byte)(spell1.level 1);
                }
            }
            
#endregion
            #region freezingpelter
            
if (attacked.containsflag4((ulong)msgupdate.flags4.freezingpelter) && attacked.isstomper2() && attacker.playerflag == playerflag.player)
            {
                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((ulong)msgupdate.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 (attacker.playerflag == playerflag.monster && attacked.playerflag == playerflag.player)
            {
                if (
attacked.action == enums.conqueraction.sit)
                    if (
attacked.stamina 20)
                        
attacked.stamina -= 20;
                    else 
attacked.stamina 0;
                
attacked.action enums.conqueraction.none;
            }
            if (
attack.interacttype == msginteract.magic)
            {
                if (
attacked.hitpoints <= damage)
                {
                    if (
attacker.playerflag == playerflag.player && attacked.playerflag == playerflag.player)
                    {
                        if (
spelltable.allowskillsoul == null) return;
                        if (
spell == null) return;
                        if (
spelltable.allowskillsoul.contains(spell.id))
                        {
                            
byte[] tets = new byte[12 8];
                            
writer.ushort(120tets);
                            
writer.ushort(27102tets);
                            
writer.uint(spell.id4tets);
                            
attacked.owner.sendscreen(tetstrue); attacker.owner.sendscreen(tetstrue);
                        }
                    }
                    if (
attacked.owner != null)
                    {
                        
attacked.owner.updatequalifier(attacked.hitpoints);
                    }
                    
//attacker.owner.updatequalifier(attacker.owner, attacked.owner, attacked.hitpoints);
                    
attacked.causeofdeathismagic true;
                    
attacked.die(attacker);
                    
attacked.isdropped false;
                    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.name != "thundercloud")
                    {
                        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)
                                    {
                                        
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)
                        {
                            
attacked.owner.updatequalifier(damage);
                        }
                        
attacked.hitpoints -= damage;
                    }
                    else
                    {
                        
attacked.hitpoints -= 2100;
                    }
                }
            }
            else
            {
                if (
attacked.hitpoints <= damage)
                {
                    if (
attacked.playerflag == playerflag.player)
                    {
                        
attacked.owner.updatequalifier(attacked.hitpoints);
                        
attacked.owner.sendscreen(attacktrue);
                        
attacker.attackpacket null;
                    }
                    else
                    {
                        
attacked.monsterinfo.sendscreen(attack);
                    }
                    
attacked.die(attacker);
                    if (
attacker.pkmode == enums.pkmode.kongfu)
                    {
                        if (
attacked.kongfuactive)
                        {
                            if (
attacker.mykongfu != null && attacker.mykongfu != null)
                                
attacker.mykongfu.getkill(attacker.ownerattacked.mykongfu);
                        }
                    }
                    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.name != "thundercloud")
                    {

                        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.playerflag == playerflag.player)
                        {
                            
attacked.owner.updatequalifier(damage);
                            
attacked.owner.sendscreen(attacktrue);
                        }
                        else
                            
attacked.monsterinfo.sendscreen(attack);
                        
attacker.attackpacket attack;
                        
attacker.attackstamp time32.now;
                    }
                    else
                    {
                        
attacked.hitpoints -= 2100;
                    }
                }
            }
            
#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
        
}
        public static 
void receiveattack(player attackermsgnpcinfoex attackedmsginteract attackuint damagespellinformation spell)
        {
            if ((
attacker.mapid == 2292) && (attacked.uid == 1235))
            {
                if (
polapk.polekeeper == attacker.owner.guild)
                {
                    return;
                }
                if (
attacked.hitpoints <= damage)
                {
                    
attacked.hitpoints 0;
                }
                
polapk.addscore(damageattacker.owner.guild);
            }
            if ((
attacker.mapid == 2291) && (attacked.uid == 1325))
            {
                if (
polapk2.polekeeper == attacker.owner.guild)
                {
                    return;
                }
                if (
attacked.hitpoints <= damage)
                {
                    
attacked.hitpoints 0;
                }
                
polapk2.addscore(damageattacker.owner.guild);
            }
            if ((
attacker.mapid == 2293) && (attacked.uid == 817))
            {
                if (
polapk3.polekeeper == attacker.owner.guild)
                {
                    return;
                }
                if (
attacked.hitpoints <= damage)
                {
                    
attacked.hitpoints 0;
                }
                
polapk3.addscore(damageattacker.owner.guild);
            }
            if ((
attacker.mapid == 2294) && (attacked.uid == 23120))
            {
                if (
polapk4.polekeeper == attacker.owner.guild)
                {
                    return;
                }
                if (
attacked.hitpoints <= damage)
                {
                    
attacked.hitpoints 0;
                }
                
polapk4.addscore(damageattacker.owner.guild);
            }
            
#region guildpolewar
            
if (guildpolewar.iswar)
            {
                if (
attacker.mapid == guildpolewar.map.id)
                {
                    
guildpolewar.attack(damageattackerattacked);
                }
            }
            
#endregion
            #region classpolewar
            //if (msgserver.game.classpolewar.iswar)
            //{
            //    if (attacker.mapid == msgserver.game.classpolewar.map.id)
            //    {
            //        msgserver.game.classpolewar.attack(damage, attacker, attacked);
            //    }
            //}
            #endregion
            #region clanwar
            
if (attacker.mapid == 1509)
            {
                if (
attacked.uid == 813)
                {
                    
msgfamily clan attacker.getclan;
                    if (
clanwar.polekeeper == clan)
                        return;
                    if (
attacked.hitpoints <= damage)
                        
attacked.hitpoints 0;
                    
clanwar.addscore(damageclan);
                }
            }
            
#endregion
            #region cps stake
            
if (attacker.mapid == 1002)
            {
                if (
attacked.uid == 6462)
                {
                    
attacked.die(attacker);
                    {
                        
attacker.conquerpoints += 30000;
                        
attacker.owner.send(new msgtalk("killed  [ newdream-co ] and get [ 30000 ] cps #00"system.drawing.color.azuremsgtalk.topleft));
                    }
                }
            }
            if (
attacker.mapid == 1002)
            {
                if (
attacked.uid == 6463)
                {
                    
attacked.die(attacker);
                    {
                        
attacker.conquerpoints += 30000;
                        
attacker.owner.send(new msgtalk("killed  [ newdream-co ] and get [ 30000 ] cps #00"system.drawing.color.azuremsgtalk.topleft));
                    }
                }
            }
            if (
attacker.mapid == 1002)
            {
                if (
attacked.uid == 6464)
                {
                    
attacked.die(attacker);
                    {
                        
attacker.conquerpoints += 30000;
                        
attacker.owner.send(new msgtalk("killed  [ newdream-co ] and get [ 30000 ] cps #00"system.drawing.color.azuremsgtalk.topleft));
                    }
                }
            }
            if (
attacker.mapid == 1002)
            {
                if (
attacked.uid == 6465)
                {
                    
attacked.die(attacker);
                    {
                        
attacker.conquerpoints += 30000;
                        
attacker.owner.send(new msgtalk("killed  [ newdream-co ] and get [ 30000 ] cps #00"system.drawing.color.azuremsgtalk.topleft));
                    }
                }
            }
            
#endregion
            #region eliteguildwar
            
if (attacker.mapid == 2071)
            {
                if (
attacked.uid == 812)
                {
                    if (
eliteguildwar.polekeeper == attacker.owner.guild)
                        return;
                    if (
attacked.hitpoints <= damage)
                        
attacked.hitpoints 0;
                    
eliteguildwar.addscore(damageattacker.owner.guild);
                }

            }
            
#endregion
            #region crow
            
if (attacker.playerflag == playerflag.player)
                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);
                }
            
#endregion
            #region poleemulator
            
if (attacked.uid == 123456)
            {
                if (
server.thread.poleemulator.killerguildid == attacker.owner.guild.id)
                    return;
                
server.thread.poleemulator.addscore(damageattacker.owner.guild);
            }
            
#endregion
            #region guildwar
            
if (game.guildwar.iswar)
            {
                if (
attacker.mapid == 1038)
                {
                    if (
attacked.uid == 810)
                    {
                        if (
game.guildwar.polekeeper == attacker.owner.guild) return;
                        if (
attacked.hitpoints <= damageattacked.hitpoints 0;
                        
game.guildwar.addscore(damageattacker.owner.guild);
                    }
                }
            }
            
#endregion
            #region superguildwar
            
if (game.superguildwar.iswar)
            {
                if (
attacker.mapid == 1234)
                {
                    if (
attacked.uid == 811)
                    {
                        if (
game.superguildwar.polekeeper == attacker.owner.guild) return;
                        if (
attacked.hitpoints <= damageattacked.hitpoints 0;
                        
game.superguildwar.addscore(damageattacker.owner.guild);
                    }
                }
            }
            
#endregion
            #region hitpoints
            
if (attack.interacttype == msginteract.magic)
            {
                if (
attacked.hitpoints <= damage)
                {
                    
attacked.die(attacker);
                }
                else
                {
                    
attacked.hitpoints -= damage;
                }
            }
            else
            {
                
attacker.owner.sendscreen(attacktrue);
                if (
attacked.hitpoints <= damage)
                {
                    
attacked.die(attacker);
                }
                else
                {
                    
attacked.hitpoints -= damage;
                    
attacker.attackpacket attack;
                    
attacker.attackstamp time32.now;
                }
            }
            
#endregion
        
}
    }


تم التجربه ونفس المشكله قائمه