عرض مشاركة واحدة
احصائياتى

الردود
9

المشاهدات
2624
 
محمودمحمدسالم

محمودمحمدسالم is on a distinguished road

    غير متواجد

المشاركات
426

+التقييم
0.19

تاريخ التسجيل
Apr 2019

الاقامة

نظام التشغيل

رقم العضوية
63
2020-03-19, 08:43 AM
المشاركة 1 
#1  
افتراضي الاج عندي في سورس رايزو راهيب و مش لاقي حل
البنج بيرفع في اوقات غريبه كدا مش فاهم لي
و مفيش معاد مظبوط عشان اشوف المشكلة من حرب ولا من اي بظبط
و لغيت الودر بتاع الاسباني و نفس النظام
البنج بيرفع سعات لي 10 ك و اكتر
و ال سحب بتاع سورس بيزيد سحب Cpu لي 60 و 70 % و سعات بيقل لي 10 و 5 % و سعات بيزيد لي 30 و 40 % و الاونلاين مش بيزيد عشان اقول الحوار ده من الاونلاين

ده ال World

كود:
using Rayzo.Game;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Rayzo.Network.GamePackets;
using System.Threading;
using System.Threading.Generic;
using Rayzo.Network.Sockets;
using Rayzo.Game.ConquerStructures;
using Rayzo.Game.ConquerStructures.Society;
using Rayzo.Client;
using System.Drawing;
using Rayzo.Network.GamePackets.EventAlert;
using Rayzo.Game.Events;
using Rayzo.Database;
using System.Data.SqlClient;
using System.Configuration;
using Rayzo.Copra;
using Rayzo.Game.Features.Tournaments;
using Rayzo.Interfaces;
using Rayzo.MaTrix;
using Rayzo.Game.MsgServer;
using Rayzo.Game.MsgTournaments;
using Rayzo.Network;

namespace 
Rayzo
{
    public class 
World
    
{
        
/// <summary>
        /// </summary>
        /// 
        
public static long Carnaval 0;
        public static 
MsgSquidwardOctopus SquidwardOctopus;
        
#region Cyclone War
        
public static bool cycolne false;
        public static 
bool cycolne1 false;
        public static 
bool LastTeam false;
        
#endregion Cyclone War
        
public static bool Faster false;
        public static 
bool Faster1 false;
        public static 
bool Faster2 false;
        public static 
StaticPool GenericThreadPool;
        public static 
TimerRule<Poker.Structures.PokerTablePokerTables;
        public static 
StaticPool ReceivePoolSendPool;
        public 
TimerRule<GameStateBuffersCharactersAutoAttackPrayer;
        public 
TimerRule<ClientWrapperConnectionReceiveConnectionReviewConnectionSend;

        public const 
uint
            NobilityMapBase 
700,
            
ClassPKMapBase 1730;

        public List<
KillTournamentTournaments;
        public 
MsgCaptureTheFlag CTF;
        public 
bool PureLand;
        public 
HeroOfGame HeroOfGame = new HeroOfGame();
        public 
DelayedTask DelayedTask;
        public 
World()
        {
            
GenericThreadPool = new StaticPool(32).Run();
            
ReceivePool = new StaticPool(32).Run();
            
SendPool = new StaticPool(32).Run();
        }
        public 
void Init(bool onlylogin false)
        {
            if (!
onlylogin)
            {
                
Buffers = new TimerRule<GameState>(BuffersCallback1000ThreadPriority.BelowNormal);
                
Characters = new TimerRule<GameState>(CharactersCallback1000ThreadPriority.BelowNormal);
                
AutoAttack = new TimerRule<GameState>(AutoAttackCallback1000ThreadPriority.BelowNormal);
                
Prayer = new TimerRule<GameState>(PrayerCallback1000ThreadPriority.BelowNormal);
                
Subscribe(WorldTournaments1000);
                
Subscribe(ServerFunctions5000);
                
Subscribe(ArenaFunctions1000ThreadPriority.AboveNormal);
            }

           
PokerTables = new TimerRule<Poker.Structures.PokerTable>(Poker.PokerHandler.PokerTablesCallback500ThreadPriority.Highest);
        }
        public 
void CreateTournaments()
        {
            
DelayedTask = new DelayedTask();
            var 
map Kernel.Maps[700];
            
ClanWarArena.Create();
            
Game.Features.Tournaments.TeamPk.TeamTournament.Create();
            
Game.Features.Tournaments.SkillPk.SkillTournament.Create();
            new 
GuildScoreWar();
            new 
ClassPoleWar();
            new 
NobiltyPoleWar();
            new 
Lobby();
            
ElitePKTournament.Create();
            
SquidwardOctopus = new MsgSquidwardOctopus();
            
CTF = new MsgCaptureTheFlag();
       

        }
        public 
bool teletele1tele2tele3tele4tele5tele6tele7 false;
        public static 
void TeleEffect(GameState clientushort Xushort Yushort Mapuint ID)
        {
            
Database.DMaps.LoadMap(Map);
            
Game.Map map Kernel.Maps[Map];

            
FloorItem floorItem1 = new FloorItem(true);
            
floorItem1.ItemID ID;
            
floorItem1.MapID Map;
            
floorItem1.ItemColor Enums.Color.Black;
            
floorItem1.Type FloorItem.Effect;
            
floorItem1.X;
            
floorItem1.Y;
            
floorItem1.OnFloor Time32.Now;
            
floorItem1.Owner client;
            while (
map.Npcs.ContainsKey(floorItem1.UID))
                
floorItem1.UID Network.GamePackets.FloorItem.FloorUID.Next;
            
map.AddFloorItem(floorItem1);
            
client.SendScreenSpawn(floorItem1true);
        }
        public static 
uint Room1Price 0;
        public static 
uint Room2Price 0;
        public static 
uint Room3Price 0;
        public static 
uint Room4Price 0;
        public static 
uint Room5Price 0;
        public static 
uint Room6Price 0;
        public 
bool Register(Entity ThunderCloudd)
        {
            if (
ThunderCloudd.Owner.TimerSubscriptions == null)
            {
                
ThunderCloudd.Owner.TimerSyncRoot = new object();
                
ThunderCloudd.Owner.TimerSubscriptions = new IDisposable[]
                {
                    
ThunderCloud.Add(ThunderCloudd)
                };
                return 
true;
            }
            return 
false;
        }
        public 
void Unregister(Entity Thundercloud)
        {
            if (
Thundercloud.Owner == null || Thundercloud.Owner.TimerSubscriptions == null) return;
            
lock (Thundercloud.Owner.TimerSyncRoot)
            {
                if (
Thundercloud.Owner.TimerSubscriptions != null)
                {
                    foreach (var 
timer in Thundercloud.Owner.TimerSubscriptions)
                        
timer.Dispose();
                    
Thundercloud.Owner.TimerSubscriptions null;
                }
            }
        }
        public 
bool Register(GameState client)
        {
            
client.LastClientOK DateTime.Now;
            if (
client.TimerSubscriptions == null)
            {
                
client.TimerSyncRoot = new object();
                
client.TimerSubscriptions = new IDisposable[]
                {                    
                    
Buffers.Add(client),
                    
Characters.Add(client),
                    
AutoAttack.Add(client),                    
                    
Prayer.Add(client),
                };
                return 
true;
            }
            return 
false;
        }
        public 
void Unregister(GameState client)
        {
            if (
client.TimerSubscriptions == null) return;
            
lock (client.TimerSyncRoot)
            {
                if (
client.TimerSubscriptions != null)
                {
                    foreach (var 
timer in client.TimerSubscriptions)
                        
timer.Dispose();
                    
client.TimerSubscriptions null;
                }
            }
        }
        private 
bool Valid(GameState client)
        {
            if (!
client.Socket.IsAlive || client.Entity == null)
            {
                
//Console.WriteLine("Socket Not Alive " + client.Entity.Name);
                
client.Disconnect();
                return 
false;
            }
            return 
true;
        }
        private 
unsafe void BuffersCallback(GameState clientint time)
        {
            if (!
Valid(client)) return;
            
Time32 Now = new Time32(time);
            
DateTime Now64 DateTime.Now;
            
Rayzo.MsgServer.Time32 Timer Rayzo.MsgServer.Time32.Now;
            
#region Absolution
            
if (client.Entity.Absolutionbool)
            {
                if (
Now >= client.Entity.Absolution.AddSeconds((int)20))
                {
                    
client.Entity.Absolutionbool false;
                    
client.SendScreenSpawn(client.Entitytrue);
                }
            }
            
#endregion
            #region HPRuneWater
            
if (!client.Entity.Dead && Time32.Now >= client.Entity.FineRain.AddSeconds(1) && client.Entity.FineRainTime 0)
            {
                if (
client.Entity.FineRainHP >= (uint)(client.Entity.FineRainHPMin))
                {
                    
client.Entity.FineRainHP -= (uint)(client.Entity.FineRainHPMin);
                }
                else
                {
                    
client.Entity.FineRainHP 0;

                }
                if (
client.Entity.FineRainHPMax <= client.Entity.MaxHitpoints)
                {
                    
client.Entity.MaxHitpoints -= (uint)(client.Entity.FineRainHPMin);
                    
client.Entity.Hitpoints -= (uint)(client.Entity.FineRainHPMin);
                    
WindowsStats WS = new WindowsStats(client);
                    
WS.Send(client);
                }
                else
                {
                    
client.Entity.MaxHitpoints = (uint)(client.Entity.FineRainHPMax);
                    
client.Entity.Hitpoints = (uint)(client.Entity.FineRainHPMax);
                    
WindowsStats WS = new WindowsStats(client);
                    
WS.Send(client);
                }
                
client.Entity.FineRainTime--;
                if (
client.Entity.FineRainTime == 1)
                {
                    
client.Entity.RemoveFlag(MsgUpdate.Flags.FineRain);
                }
            }
            
#endregion
            #region Flag's
            
if (client.Entity.BlackSpot)
            {
                if (
Timer client.Entity.Stamp_BlackSpot)
                {
                    
client.Entity.BlackSpot false;
                    
using (var rec = new ServerSockets.RecycledPacket())
                    {
                        var 
stream rec.GetStream();

                        
client.Entity.SendScreen(stream.BlackspotCreate(falseclient.Entity.UID), true);
                    }
                }
            }
            foreach (var 
flag in client.Entity.BitVector.GetFlags())
            {
                if (
flag.Expire(Timer))
                {
                    if (
flag.Key >= (int)Game.MsgServer.MsgUpdate.Flags.TyrantAura && flag.Key <= (int)Game.MsgServer.MsgUpdate.Flags.EartAura)
                    {
                        
client.Entity.AddAura(client.Entity.UseAuranull0);
                    }
                    else
                    {
                        if (
flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.Omnipotence)
                        {
                            
client.Entity.RemoveFlag(MsgUpdate.Flags.Omnipotence);
                        }
                        if (
flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.Superman || flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.Cyclone
                            
|| flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.SuperCyclone)
                        {
                            
//Role.KOBoard.KOBoardRanking.AddItem(new Role.KOBoard.Entry() { UID = client.Entity.UID, Name = client.Entity.Name, Points = client.Entity.KillCounter }, true);
                        
}
                        
client.Entity.RemoveFlag((Game.MsgServer.MsgUpdate.Flags)flag.Key);
                    }
                }

                if (
flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.ScarofEarth)
                {
                    if (
flag.CheckInvoke(Timer))
                    {
                        if (
client.Entity.ScarofEarthl != null && client.Entity.AttackerScarofEarthl != null)
                        {
                            
int damage client.Entity.ScarofEarthl.Damage2;
                            if (
client.Entity.Hitpoints <= damage)
                            {
                                
client.Entity.Hitpoints 1;
                                
damage = (int)(client.Entity.Hitpoints 1);
                                
client.UpdateQualifier(damagetrue);
                                goto 
jump;
                            }
                            if (
client.Entity.Hitpoints == 1)
                            {
                                
damage 0;
                                goto 
jump;
                            }
                            
client.Entity.Hitpoints = (uint)Math.Max(1, ((long)client.Entity.Hitpoints - (long)damage));
                            
client.UpdateQualifier(damagetrue);

                        
jump:

                            
using (var rec = new ServerSockets.RecycledPacket())
                            {
                                var 
stream rec.GetStream();

                                
InteractQuery action = new InteractQuery()
                                {
                                    
Damage damage,
                                    
AtkType MsgAttackPacket.AttackID.Physical,
                                    
client.Entity.X,
                                    
client.Entity.Y,
                                    
OpponentUID client.Entity.UID
                                
};
                                
client.SendScreen(stream.InteractionCreate(&action), true);
                            }
                            
/*using (var rec = new ServerSockets.RecycledPacket())
                            {
                                var stream = rec.GetStream();

                                var DBSpell = client.Entity.ScarofEarthl;
                                MsgSpellAnimation MsgSpell = new MsgSpellAnimation(
                                    client.Entity.UID
                                      , 0, client.Entity.X, client.Entity.Y, DBSpell.ID
                                      , DBSpell.Level, 0, 1);

                                MsgSpellAnimation.SpellObj AnimationObj = new MsgSpellAnimation.SpellObj()
                                {
                                    UID = client.Entity.UID,
                                    Damage = (uint)DBSpell.Damage2,
                                    Hit = 1
                                };

                                Game.MsgServer.AttackHandler.ReceiveAttack.Player.Execute(AnimationObj, client.Entity.AttackerScarofEarthl, client.Entity);
                                MsgSpell.SetStream(stream);
                                MsgSpell.Targets.Enqueue(AnimationObj);
                                MsgSpell.Send(client);
                            }*/
                        
}
                    }
                }

                else if (
flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.DragonFlow)
                {
                    if (
flag.CheckInvoke(Timer))
                    {
                        
byte MaxStamina = (byte)(client.Entity.HeavenBlessing 150 100);

                        if (
client.Entity.Stamina MaxStamina)
                        {
                            
client.Entity.Stamina += 20;
                            
client.Entity.Stamina = (byte)Math.Min((int)client.Entity.StaminaMaxStamina); using (var rec = new ServerSockets.RecycledPacket())
                            {
                                var 
stream rec.GetStream();
                                
client.Entity.SendUpdate(streamclient.Entity.StaminaGame.MsgServer.MsgUpdate.DataType.Stamina);
                            }
                            
_String str = new _String(true);
                            
str.UID client.Entity.UID;
                            
str.TextsCount 1;
                            
str.Type _String.Effect;
                            
str.Texts.Add("leedragonblood");
                            
client.SendScreen(strtrue);
                        }
                    }
                }
                else if (
flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.HealingSnow)
                {
                    if (
flag.CheckInvoke(Timer) && client.Entity.Alive)
                    {
                        if (
client.Entity.Hitpoints client.Entity.MaxHitpoints || client.Entity.Mana client.Entity.MaxMana)
                        {
                            
MsgSpell spell;
                            if (
client.MySpells.ClientSpells.TryGetValue((ushort)Enums.SpellID.HealingSnowout spell))
                            {
                                var 
arrayspells Kernel.Magic[(ushort)Enums.SpellID.HealingSnow];
                                var 
DbSpell arrayspells[(ushort)Math.Min((int)spell.Levelarrayspells.Count 1)];

                                
client.Entity.Hitpoints = (uint)Math.Min(client.Entity.MaxHitpoints, (int)(client.Entity.Hitpoints DbSpell.Damage2));
                                
client.Entity.Mana = (ushort)Math.Min(client.Entity.MaxMana, (int)(client.Entity.Mana DbSpell.Damage3));
                                
client.Entity.SendUpdateHP();
                                
client.XPCount += 1;
                            }
                        }
                    }
                }
                
//else if (flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.lianhuaran01 || flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.lianhuaran02 || flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.lianhuaran03 || flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.lianhuaran04)
                //{
                //    if (flag.CheckInvoke(Timer))
                //    {
                //        int damage = (int)Game.MsgServer.AttackHandler.Calculate.Base.CalculatePoisonDamage(client.Entity.Hitpoints, (byte)client.Entity.PoisonLevel);
                //        if (damage > 1)
                //        {
                //            damage -= (int)(damage * Math.Min(100, client.Entity.ToxinEraserLevel)) / 100;

                //        }
                //        if (client.Entity.Hitpoints == 1)
                //        {
                //            damage = 0;
                //            goto jump;
                //        }
                //        damage -= (int)((damage * Math.Min((int)client.Entity.Detoxication, 90)) / 100);
                //        client.Entity.Hitpoints = (uint)Math.Max(1, ((long)client.Entity.Hitpoints - (long)damage));

                //    jump:

                //        using (var rec = new ServerSockets.RecycledPacket())
                //        {
                //            var stream = rec.GetStream();

                //            InteractQuery action = new InteractQuery()
                //            {
                //                Damage = damage,
                //                AtkType = MsgAttackPacket.AttackID.Physical,
                //                X = client.Entity.X,
                //                Y = client.Entity.Y,
                //                OpponentUID = client.Entity.UID
                //            };
                //            client.Entity.SendScreen(stream.InteractionCreate(&action), true);
                //        }

                //    }
                //}
                
else if (flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.Poisoned)
                {
                    if (
flag.CheckInvoke(Timer))
                    {
                        
int damage = (int)Game.MsgServer.AttackHandler.Calculate.Base.CalculatePoisonDamage(client.Entity.Hitpoints, (byte)client.Entity.PoisonLevel);
                        if (
damage 1)
                        {
                            
damage -= (int)(damage Math.Min((byte)100, (byte)client.Entity.ToxinEraserLevel)) / 100;

                        }
                        if (
client.Entity.Hitpoints == 1)
                        {
                            
damage 0;
                            goto 
jump;
                        }
                        
damage -= (int)((damage Math.Min((int)client.Entity.Detoxication90)) / 100);
                        
client.Entity.Hitpoints = (uint)Math.Max(1, ((long)client.Entity.Hitpoints - (long)damage));
                        
client.UpdateQualifier(damagetrue);

                    
jump:

                        
using (var rec = new ServerSockets.RecycledPacket())
                        {
                            var 
stream rec.GetStream();

                            
InteractQuery action = new InteractQuery()
                            {
                                
Damage damage,
                                
AtkType MsgAttackPacket.AttackID.Physical,
                                
client.Entity.X,
                                
client.Entity.Y,
                                
OpponentUID client.Entity.UID
                            
};
                            
client.SendScreen(stream.InteractionCreate(&action), true);
                        }
                    }
                }
                else if (
flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.ShurikenVortex)
                {
                    if (
flag.CheckInvoke(Timer))
                    {
                        
using (var rec = new ServerSockets.RecycledPacket())
                        {
                            var 
stream rec.GetStream();

                            
InteractQuery action = new InteractQuery()
                            {
                                
UID client.Entity.UID,
                                
client.Entity.X,
                                
client.Entity.Y,
                                
SpellID = (ushort)Enums.SpellID.ShurikenEffect,
                                
AtkType MsgAttackPacket.AttackID.Magic
                            
};

                            
MsgAttackPacket.ProcescMagic(clientstream.InteractionCreate(&action), action);
                        }
                    }
                }

                else if (
flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.RedName || flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.BlackName)
                {
                    if (
flag.CheckInvoke(Timer))
                    {
                        if (
client.Entity.PKPoints 0)
                            
client.Entity.PKPoints -= 1;

                        
client.Entity.PkPointsStamp Rayzo.MsgServer.Time32.Now;
                    }
                }
                else if (
flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.BurntForst)
                {
                    if (
flag.CheckInvoke(Timer))
                    {
                        
uint dmg 1000;
                        
byte Level client.Entity.BurnetLevel;
                        if (
Level 0)
                            
dmg += 1000;
                        if (
Level 1)
                            
dmg += 1000;
                        if (
Level 2)
                            
dmg += 1000;
                        if (
Level 3)
                            
dmg += 1000;
                        if (
Level 4)
                            
dmg += 1000;
                        if (
Level 5)
                            
dmg += 1000;
                        if (
client.Entity.Hitpoints dmg)
                        {
                            
client.Entity.Hitpoints -= dmg;
                        }
                        else if (
client.Entity.Hitpoints <= dmg)
                        {
                            
dmg client.Entity.Hitpoints;
                            
client.Entity.Hitpoints 1;
                            
client.Entity.RemoveFlag(MsgUpdate.Flags.BurntForst);
                        }
                        
using (var rec = new ServerSockets.RecycledPacket())
                        {
                            var 
stream rec.GetStream();

                            
InteractQuery action = new InteractQuery()
                            {
                                
Damage = (int)dmg,
                                
AtkType MsgAttackPacket.AttackID.Physical,
                                
client.Entity.X,
                                
client.Entity.Y,
                                
OpponentUID client.Entity.UID
                            
};
                            
client.SendScreen(stream.InteractionCreate(&action), true);
                        }
                    }
                }
                else if (
flag.Key == (int)Game.MsgServer.MsgUpdate.Flags.Cursed)
                {
                    if (
flag.CheckInvoke(Timer))
                    {
                        if (
client.Entity.CursedTimer 0)
                            
client.Entity.CursedTimer -= 1;
                    }
                }

            }
            
#endregion
            #region XPList
            
if (!client.Entity.ContainFlag(MsgUpdate.Flags.XPList))
            {
                if (
Timer client.XPCountStamp.AddSeconds(3))
                {
                    
#region Arrows
                    
if (client.Equipment != null)
                    {
                        if (!
client.Equipment.Free(5))
                        {
                            if (
Network.PacketHandler.IsArrow(client.Equipment.TryGetItem(5).ID))
                            {
                                
Database.ConquerItemTable.UpdateDurabilityItem(client.Equipment.TryGetItem(5));
                            }
                        }
                    }
                    
#endregion
                    
client.XPCountStamp Timer;
                    
client.XPCount += 1;
                    if (
client.XPCount >= 100)
                    {
                        if (
client.Entity.OnXPSkill() == MsgUpdate.Flags.Normal)
                            
client.Entity.AddFlag(MsgUpdate.Flags.XPList20true);
                        
client.XPCount 0;
                    }
                }
            }
            if (
client.Entity.ContainFlag(MsgUpdate.Flags.XPList))
            {
                if (
Now client.XPListStamp.AddSeconds(20))
                {
                    
UpdateProto Update = new UpdateProto();
                    
Update.Time = (uint)Time32.timeGetTime().GetHashCode();
                    
Update.UID client.Entity.UID;
                    
Update.update = new UpdateFlag[1];
                    
Update.update[0] = new UpdateFlag();
                    
Update.update[0].Type 101;
                    
Update.update[0].value = (ulong)0;
                    
client.Send(MsgUpdate.SendPacket(Update));
                }
            }
            if (
client.Entity.InUseIntensify)
            {
                if (
Timer client.Entity.IntensifyStamp.AddSeconds(2))
                {
                    if (!
client.Entity.Intensify)
                    {
                        
client.Entity.Intensify true;
                        
client.Entity.InUseIntensify false;
                        
client.Entity.RemoveFlag(MsgUpdate.Flags.Intensify);
                        
client.Entity.IntensifyPercent 0;
                    }
                }
            }
            
#endregion
            #region JiangTime
            
if (client.Entity.MyJiang != null)
            {
                
client.Entity.MyJiang.TheadTime(client);
            }
            
#endregion
            #region KingDay
            
if (client.Entity.kingDay != 0)
            {
                
TimeSpan span1 = new TimeSpan(client.Entity.King.AddDays(client.Entity.kingDay).Ticks);
                
TimeSpan span2 = new TimeSpan(DateTime.Now.Ticks);
                
int secondsleft = (int)(span1.TotalSeconds span2.TotalSeconds);
                if (
secondsleft <= 0)
                {
                    
client.Entity.NobilityRank NobilityRank.Serf;
                }
                else
                {
                    
client.Entity.NobilityRank NobilityRank.King;
                }
            }
            
#endregion
            /*
            #region Treasure In Blue
            if ((DateTime.Now.Hour == 12 || ((Now64.DayOfWeek != DayOfWeek.Thursday && Now64.DayOfWeek != DayOfWeek.Friday) && Now64.Hour == 20)) && Now64.Minute == 30 && Now64.Second == 4)
            {
                object[] name = new object[] { "Treasure in Blue has begun! Go to Twin City to signup at SquidwardOctopus!" };
                Kernel.SendWorldMessage(new Message(string.Concat(name), "ALLUSERS", "Treasure Blue", System.Drawing.Color.Red, 2500), Program.GamePool);
                foreach (var clients in Program.GamePool)
                    clients.MessageBox("Treasure in Blue has begun! Would you like to join?",
                        p => { p.Entity.Teleport(1002, 333, 283); }, null);
                Kernel.TreasureinBlue = true;
                Kernel.CoperCoins = 200;
                Kernel.GoldCoins = 100;
                Kernel.SilverCoins = 150;
            }
            if ((Now64.Hour == 13 || ((Now64.DayOfWeek != DayOfWeek.Thursday && Now64.DayOfWeek != DayOfWeek.Friday) && Now64.Hour == 21)) && Now64.Minute == 30 && Now64.Second == 4)
            {
                object[] name = new object[] { "Treasure in Blue has been closed. Please try next time!" };
                Kernel.SendWorldMessage(new Message(string.Concat(name), "ALLUSERS", "[Treasure Blue]", System.Drawing.Color.Red, 0x9c4), Program.GamePool);
                Kernel.TreasureinBlue = false;
                foreach (GameState state in Program.GamePool)
                {
                    if (state.Entity.MapID == 0xbff)
                    {
                        state.Entity.Teleport(0x3ea, 0x129, 0x11a);
                    }
                }
            }
            #endregion
             * */
            #region Bless
            
if (client.Entity.ContainFlag(MsgUpdate.Flags.CastPray))
            {
                if (
client.BlessTime <= 7198500)
                    
client.BlessTime += 3000;
                else
                    
client.BlessTime 7200000;
                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();
                    
client.Entity.SendUpdate(streamclient.BlessTimeGame.MsgServer.MsgUpdate.DataType.LuckyTimeTimer);
                }
            }
            else if (
client.Entity.ContainFlag(MsgUpdate.Flags.Praying))
            {
                if (
client.PrayLead != null)
                {
                    if (
client.PrayLead.Socket.IsAlive)
                    {
                        if (
client.BlessTime <= 7199000)
                            
client.BlessTime += 500;
                        else
                            
client.BlessTime 7200000;
                        
using (var rec = new ServerSockets.RecycledPacket())
                        {
                            var 
stream rec.GetStream();
                            
client.Entity.SendUpdate(streamclient.BlessTimeGame.MsgServer.MsgUpdate.DataType.LuckyTimeTimer);
                        }
                    }

                }
            }
            else
            {
                if (
client.BlessTime 0)
                {
                    if (
client.BlessTime >= 500)
                        
client.BlessTime -= 350;
                    else
                        
client.BlessTime 0;
                    
using (var rec = new ServerSockets.RecycledPacket())
                    {
                        var 
stream rec.GetStream();
                        
client.Entity.SendUpdate(streamclient.BlessTimeGame.MsgServer.MsgUpdate.DataType.LuckyTimeTimer);
                    }
                }
            }
            
#endregion
            #region VIP Monster Map
            
if (client.Entity.VipMonsterPoints == 1500)
            {
                if (
client.Map.ID == 7805 || client.Map.ID == 7806 ||
                    
client.Map.ID == 7807 || client.Map.ID == 7808 ||
                    
client.Map.ID == 7809 || client.Map.ID == 7810)
                {
                    
#region choice depend on vip level
                    
switch (client.Entity.VIPLevel)
                    {
                        case 
0:
                            {
                                
client.Entity.VipMonsterPoints 0;
                                
client.MessageBox(" You Get Your Box Level 1 Open It Now");
                                
client.Inventory.Add(780501);
                                break;
                            }
                        case 
1:
                            {
                                
client.Entity.VipMonsterPoints 0;
                                
client.MessageBox(" You Get Your Box Level 2 Open It Now");
                                
client.Inventory.Add(780601);
                                break;
                            }
                        case 
2:
                            {
                                
client.Entity.VipMonsterPoints 0;
                                
client.MessageBox(" You Get Your Box Level 3 Open It Now");
                                
client.Inventory.Add(780701);
                                break;
                            }
                        case 
3:
                            {
                                
client.Entity.VipMonsterPoints 0;
                                
client.MessageBox(" You Get Your Box Level 4 Open It Now");
                                
client.Inventory.Add(780801);
                                break;
                            }
                        case 
4:
                            {
                                
client.Entity.VipMonsterPoints 0;
                                
client.MessageBox(" You Get Your Box Level 5 Open It Now");
                                
client.Inventory.Add(780901);
                                break;
                            }
                        case 
5:
                            {
                                
client.Entity.VipMonsterPoints 0;
                                
client.MessageBox(" You Get Your Box Level 6 Open It Now");
                                
client.Inventory.Add(781001);
                                break;
                            }
                    
#endregion

                    
}
                }
            }
            
#endregion
            #region JiangCalmDown
            
if (client.Entity.MyJiang != null && client.Entity.JiangActive && client.Entity.MyJiang.OnShutDown)
            {
                if (
Now client.Entity.MyJiang.StartJiang.AddSeconds(1))
                {
                    
client.Entity.MyJiang.StartJiang Time32.Now;
                    if (
client.Entity.MyJiang.SecondsEnd != 0)
                    {
                        
client.Entity.MyJiang.SecondsEnd--;
                        new 
Database.MySqlCommand(Database.MySqlCommandType.Update).Update("jianghu").Set("SecondsLeft"client.Entity.MyJiang.SecondsEnd).Where("EntityID"client.Entity.UID).Execute();
                    }
                    else
                    {
                        
client.Entity.MyJiang.SendOnline(clientfalse);
                        
client.Entity.SendMessage("Your jiang has diabled!");
                    }
                }
            }
            
#endregion
            #region Arena Quit
            
if (client.InArenaQualifier() && client.Map.BaseID != 700)
            {
                
Game.Arena.QualifyEngine.DoGiveUp(client);
            }
            
#endregion
            #region Team Aura
            //if (!client.TeamAura && !client.Entity.Aura_isActive)
            //{
            //    if (client.Team != null && !client.Entity.Dead && client.Team.Teammates != null)
            //    {
            //        foreach (Client.GameState pClient in client.Team.Teammates)
            //        {
            //            if (client.Entity.UID != pClient.Entity.UID && Kernel.GetDistance(client.Entity.X, client.Entity.Y, pClient.Entity.X, pClient.Entity.Y) <= Constants.pScreenDistance)
            //            {
            //                if (pClient.Entity.Aura_isActive && pClient.Socket.Alive && pClient.Entity.UID != client.Entity.UID && pClient.Entity.MapID == client.Entity.MapID && !pClient.Entity.Dead)
            //                {
            //                    //   if (pClient.Entity.Aura_actType == MsgUpdate.Flags2.FendAura || pClient.Entity.Aura_actType == MsgUpdate.Flags2.TyrantAura)
            //                    {
            //                        client.TeamAura = true;
            //                        client.TeamAuraOwner = pClient;
            //                        client.TeamAuraStatusFlag = pClient.Entity.Aura_actType;
            //                        client.TeamAuraPower = pClient.Entity.Aura_actPower;
            //                        client.TeamAuraLevel = pClient.Entity.Aura_actLevel;
            //                        client.Entity.AddFlag(client.TeamAuraStatusFlag);
            //                        MsgUpdate.AuraType aura = MsgUpdate.AuraType.TyrantAura;
            //                        switch (pClient.Entity.Aura_actType)
            //                        {
            //                            case MsgUpdate.Flags2.EarthAura: aura = MsgUpdate.AuraType.EarthAura; break;
            //                            case MsgUpdate.Flags2.FireAura: aura = MsgUpdate.AuraType.FireAura; break;
            //                            case MsgUpdate.Flags2.WaterAura: aura = MsgUpdate.AuraType.WaterAura; break;
            //                            case MsgUpdate.Flags2.WoodAura: aura = MsgUpdate.AuraType.WoodAura; break;
            //                            case MsgUpdate.Flags2.MetalAura: aura = MsgUpdate.AuraType.MetalAura; break;
            //                            case MsgUpdate.Flags2.FendAura: aura = MsgUpdate.AuraType.FendAura; break;
            //                            case MsgUpdate.Flags2.TyrantAura: aura = MsgUpdate.AuraType.TyrantAura; break;
            //                        }
            //                        new Update(true).Aura(client.Entity, MsgUpdate.AuraDataTypes.Add, aura, client.TeamAuraLevel, client.TeamAuraPower);
            //                        client.doAuraBonuses(client.TeamAuraStatusFlag, client.TeamAuraPower, 1);
            //                        break;
            //                    }
            //                }
            //            }
            //        }
            //    }
            //}
            //else
            //{
            //    MsgUpdate.AuraType aura = MsgUpdate.AuraType.TyrantAura;
            //    switch (client.TeamAuraStatusFlag)
            //    {
            //        case MsgUpdate.Flags2.EarthAura: aura = MsgUpdate.AuraType.EarthAura; break;
            //        case MsgUpdate.Flags2.FireAura: aura = MsgUpdate.AuraType.FireAura; break;
            //        case MsgUpdate.Flags2.WaterAura: aura = MsgUpdate.AuraType.WaterAura; break;
            //        case MsgUpdate.Flags2.WoodAura: aura = MsgUpdate.AuraType.WoodAura; break;
            //        case MsgUpdate.Flags2.MetalAura: aura = MsgUpdate.AuraType.MetalAura; break;
            //        case MsgUpdate.Flags2.FendAura: aura = MsgUpdate.AuraType.FendAura; break;
            //        case MsgUpdate.Flags2.TyrantAura: aura = MsgUpdate.AuraType.TyrantAura; break;
            //    }
            //    var pClient = client.TeamAuraOwner;

            //    if (pClient == null)
            //    {
            //        client.TeamAura = false;
            //        new Update(true).Aura(client.Entity, MsgUpdate.AuraDataTypes.Remove, aura, client.TeamAuraLevel, client.TeamAuraPower);
            //        //client.removeAuraBonuses(client.TeamAuraStatusFlag, client.TeamAuraPower, 1);
            //        client.removeAuraBonuses(client.TeamAuraStatusFlag, client.TeamAuraPower, 1);
            //        client.Entity.RemoveFlag(client.TeamAuraStatusFlag);
            //        client.TeamAuraStatusFlag = 0;
            //        client.TeamAuraPower = 0;
            //        client.TeamAuraLevel = 0;
            //    }
            //    else
            //    {
            //        if (!pClient.Entity.Aura_isActive || !pClient.Socket.Alive || pClient.Entity.Dead || pClient.Entity.MapID != client.Entity.MapID || pClient.Entity.Aura_actType != client.TeamAuraStatusFlag)
            //        {
            //            client.TeamAura = false;
            //            new Update(true).Aura(client.Entity, MsgUpdate.AuraDataTypes.Remove, aura, client.TeamAuraLevel, client.TeamAuraPower);
            //            //client.removeAuraBonuses(client.TeamAuraStatusFlag, client.TeamAuraPower, 1);
            //            client.removeAuraBonuses(client.TeamAuraStatusFlag, client.TeamAuraPower, 1);
            //            client.Entity.RemoveFlag(client.TeamAuraStatusFlag);
            //            client.TeamAuraStatusFlag = 0;
            //            client.TeamAuraPower = 0;
            //            client.TeamAuraLevel = 0;
            //        }
            //        else
            //        {
            //            if (client.Team == null || (pClient.Team == null || (pClient.Team != null && !pClient.Team.IsTeammate(client.Entity.UID))) || client.Entity.Dead || Kernel.GetDistance(client.Entity.X, client.Entity.Y, pClient.Entity.X, pClient.Entity.Y) > Constants.pScreenDistance)
            //            {
            //                client.TeamAura = false;
            //                new Update(true).Aura(client.Entity, MsgUpdate.AuraDataTypes.Remove, aura, client.TeamAuraLevel, client.TeamAuraPower);
            //                client.removeAuraBonuses(client.TeamAuraStatusFlag, client.TeamAuraPower, 1);
            //                client.Entity.RemoveFlag(client.TeamAuraStatusFlag);
            //                client.TeamAuraStatusFlag = 0;
            //                client.TeamAuraPower = 0;
            //                client.TeamAuraLevel = 0;
            //            }
            //        }
            //    }

            //}
            #endregion
            #region portals
            
if (client.Entity.MapID == 2222)
            {
                
#region First Map
                
TeleEffect(client3840222224);
                
TeleEffect(client384522221050);
                
TeleEffect(client3850222224);
                
TeleEffect(client385522221050);
                
TeleEffect(client3860222224);
                if (
client.Entity.== 38 && client.Entity.== 40)
                {
                    if (
tele == false)
                    {
                        
client.Entity.Teleport(1002410354);
                        
tele true;
                    }
                    else { 
client.Entity.Teleport(23235050); tele false; }
                }
                else if (
client.Entity.== 38 && client.Entity.== 45)
                {
                    if (
tele1 == false)
                    {
                        
client.Entity.Teleport(23235050);
                        
tele1 true;
                    }
                    else { 
client.Entity.Teleport(1002410354); tele1 false; }
                }
                else if (
client.Entity.== 38 && client.Entity.== 50)
                {
                    if (
tele2 == false)
                    {

                        
client.Entity.Teleport(1002410354);
                        
tele2 true;
                    }
                    else { 
client.Entity.Teleport(23235050); tele2 false; }
                }
                else if (
client.Entity.== 38 && client.Entity.== 55)
                {
                    if (
tele3 == false)
                    {
                        
client.Entity.Teleport(23235050);

                        
tele3 true;
                    }
                    else { 
client.Entity.Teleport(1002410354); tele3 false; }
                }
                else if (
client.Entity.== 38 && client.Entity.== 60)
                {
                    if (
tele4 == false)
                    {

                        
client.Entity.Teleport(1002410354);
                        
tele4 true;
                    }
                    else { 
client.Entity.Teleport(23235050); tele4 false; }
                }
                
#endregion
            
}
            if (
client.Entity.MapID == 2323)
            {
                
#region Second Map
                
TeleEffect(client3840232324);
                
TeleEffect(client385023231050);
                
TeleEffect(client3860232324);
                if (
client.Entity.== 38 && client.Entity.== 40)
                {
                    if (
tele5 == false)
                    {
                        
client.Entity.Teleport(1002410354);
                        
tele5 true;
                    }
                    else { 
client.Entity.Teleport(21215050); tele5 false; }
                }
                else if (
client.Entity.== 38 && client.Entity.== 50)
                {
                    if (
tele6 == false)
                    {
                        
client.Entity.Teleport(21215050);
                        
tele6 true;
                    }
                    else { 
client.Entity.Teleport(1002410354); tele6 false; }
                }
                else if (
client.Entity.== 38 && client.Entity.== 60)
                {
                    if (
tele7 == false)
                    {
                        
client.Entity.Teleport(1002410354);
                        
tele7 true;
                    }
                    else { 
client.Entity.Teleport(21215050); tele7 false; }
                }
                
#endregion
            
}
            
#endregion
        
}
            
/*
            if (Now64.Hour == 13 && Now64.Minute == 00 && Now64.Second == 00) //Time Start 
            {
                Program.Nobility = true;
                Database.NobilityTable.Load();
            }
            if (Now64.Hour == 15 && Now64.Minute == 00 && Now64.Second == 00) //Time End 
            {
                Program.Nobility = false;
                Database.NobilityTable.Load();
            }  

            #region Wanted
            if (client.Entity.inkillmode == 1)
            {
                if (client.Entity.wantedeffect.AddSeconds(2) < Time32.Now)
                {
                    client.Entity.wantedeffect = Time32.Now;
                    //client.Entity.Update(_String.Effect, "juren", true);
                }
            }
            if (client.Entity.inkillmode == 1)
            {
                if (client.Entity.KillerTime.AddHours(3) < DateTime.Now)
                {
                    client.Send(new Network.GamePackets.Message("" + client.Entity.Name + "  Got :" + (client.Entity.KillerCps / 2) + "Forme Wonted System FOr No One Can Kill Him ", System.Drawing.Color.Red, Network.GamePackets.Message.Qualifier));
                    client.Entity.inkillmode = 0;
                    client.Entity.ConquerPoints += (client.Entity.KillerCps / 2);
                    Program.AddCpsWin(client.Entity.Name + " Won " + (client.Entity.KillerCps / 2) + " Cps From  Wanted Hes Is Serviv :");
                    client.Entity.KillerCps = 0;
                    EntityTable.KillerTime(client);
                }
            }
            #endregion
            if (Now64.Hour == 14 && Now64.Minute == 00 && Now64.Second == 00) //Time Start 
            {
                Program.Nobility = true;
                Database.NobilityTable.Load();
            }
            if (Now64.Hour == 16 && Now64.Minute == 00 && Now64.Second == 00) //Time End 
            {
                Program.Nobility = false;
                Database.NobilityTable.Load();
            }  
            /*
            #region AutoHunting
            if (client.Entity.ContainFlag((MsgUpdate.Flags.AutoHunt)))
            {
                if (Now > client.Entity.AutoHuntStamp.AddMinutes(15))
                {
                    client.Entity.RemoveFlag(MsgUpdate.Flags.AutoHunt);
                }
            }
            #endregion
            /*
            #region CTF Flag
            if (client.Entity.ContainFlag(MsgUpdate.Flags.CTF_Flag))
            {
                if (Time32.Now > client.Entity.FlagStamp.AddSeconds(60))
                {
                    client.Entity.RemoveFlag(MsgUpdate.Flags.CTF_Flag);
                }
            }
            #endregion
          /* 
           *
           * #endregion
            if (DateTime.Now.Hour == 0 && DateTime.Now.Minute == 30 && DateTime.Now.Second == 1)
            {
                if (DateTime.Now.Hour == 2000000 && DateTime.Now.Minute == 30 && DateTime.Now.Second == 1)
                {
                    Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "EmpirorWar PK has Started! You Wana Join?");
                    npc.OptionID = 233;
                    client.Send(npc.ToArray());
                    //return;   

                }
            }  

        }
           * */
        #region SkillisWindWalker
        
public TimerRule<EntityThunderCloud;
        private 
void ThunderCloudTimer(Entity ThunderCloudint time)
        {
            if (
ThunderCloud == null) return;
            if (!
Kernel.Maps.ContainsKey(ThunderCloud.MapID))
            {
                
Kernel.Maps[ThunderCloud.MapID].RemoveEntity(ThunderCloud);

                
MsgActionProto Action = new MsgActionProto();
                
Action.ID MsgActionEmulator.RemoveEntity;
                
Action.UID ThunderCloud.UID;
                
Action.TimeStamp = (uint)Time32.Now.GetHashCode();
                
ThunderCloud.Send(MsgActionEmulator.SendPacket(Action));
                foreach (var 
client in Kernel.GamePool.Values)
                {
                    if (
Kernel.GetDistance(ThunderCloud.XThunderCloud.Yclient.Entity.Xclient.Entity.Y) > 16) continue;
                    
client.RemoveScreenSpawn(ThunderCloudtrue);
                }
                
Unregister(ThunderCloud);
                return;
            }
            if (
Time32.Now >= ThunderCloud.ThunderCloudStamp.AddSeconds(1))
            {
                
ThunderCloud.ThunderCloudStamp Time32.Now;
                if (
ThunderCloud.Hitpoints 400)
                    
ThunderCloud.Hitpoints -= 400;
                else
                {
                    
Kernel.Maps[ThunderCloud.MapID].RemoveEntity(ThunderCloud);
                    
MsgActionProto Action = new MsgActionProto();
                    
Action.ID MsgActionEmulator.RemoveEntity;
                    
Action.UID ThunderCloud.UID;
                    
Action.TimeStamp = (uint)Time32.Now.GetHashCode();
                    
ThunderCloud.MonsterInfo.SendScreen(MsgActionEmulator.SendPacket(Action));
                    foreach (var 
client in Kernel.GamePool.Values)
                    {
                        if (
Kernel.GetDistance(ThunderCloud.XThunderCloud.Yclient.Entity.Xclient.Entity.Y) > 16) continue;
                        
client.RemoveScreenSpawn(ThunderCloudtrue);
                    }
                    
Unregister(ThunderCloud);
                    return;
                }
            }
            
#region ThunderCloud
            //if ((ThunderCloud.SpawnPacket[50] == 0 && Time32.Now >= ThunderCloud.MonsterInfo.LastMove.AddMilliseconds(750)) || ThunderCloud.SpawnPacket[50] == 128)
            //{
            //    ThunderCloud.MonsterInfo.LastMove = Time32.Now;
            //    if (ThunderCloud.MonsterInfo.InSight == 0)
            //    {
            //        foreach (var one in Kernel.Maps[ThunderCloud.MapID].Entities.Values.Where(i => Kernel.GetDistance(ThunderCloud.X, ThunderCloud.Y, i.X, i.Y) <= ThunderCloud.MonsterInfo.AttackRange))
            //        {
            //            if (one == null || one.Dead || one.MonsterInfo.Guard || one.Companion) continue;
            //            ThunderCloud.MonsterInfo.InSight = one.UID;
            //            Entity insight = null;
            //            if (Kernel.Maps[ThunderCloud.MapID].Entities.ContainsKey(ThunderCloud.MonsterInfo.InSight))
            //                insight = Kernel.Maps[ThunderCloud.MapID].Entities[ThunderCloud.MonsterInfo.InSight];
            //            else if (Kernel.GamePool.ContainsKey(ThunderCloud.MonsterInfo.InSight))
            //                insight = Kernel.GamePool[ThunderCloud.MonsterInfo.InSight].Entity;
            //            if (insight == null || insight.Dead || (insight.MonsterInfo != null && insight.MonsterInfo.Guard))
            //            {
            //                ThunderCloud.MonsterInfo.InSight = 0;
            //                break;
            //            }
            //            new Game.Attacking.Handle(null, ThunderCloud, insight);
            //            break;
            //        }
            //    }
            //    else
            //    {
            //        Entity insight = null;
            //        if (Kernel.Maps[ThunderCloud.MapID].Entities.ContainsKey(ThunderCloud.MonsterInfo.InSight))
            //            insight = Kernel.Maps[ThunderCloud.MapID].Entities[ThunderCloud.MonsterInfo.InSight];
            //        else if (Kernel.GamePool.ContainsKey(ThunderCloud.MonsterInfo.InSight))
            //            insight = Kernel.GamePool[ThunderCloud.MonsterInfo.InSight].Entity;
            //        if (insight == null || insight.Dead || (insight.MonsterInfo != null && insight.MonsterInfo.Guard))
            //        {
            //            ThunderCloud.MonsterInfo.InSight = 0;
            //            return;
            //        }
            //        new Game.Attacking.Handle(null, ThunderCloud, insight);
            //    }
            //}
#endregion
        
}
        
#endregion
        
private void CharactersCallback(GameState clientint time)
        {
            if (!
Valid(client)) return;
            
Time32 Now32 = new Time32(time);
            
DateTime Now64 DateTime.Now;
            
Rayzo.MsgServer.Time32 Timer Rayzo.MsgServer.Time32.Now;
            

            
#region mad but must be done Protected by CopyRights
            #region mad but must be done
            #region mad but must be done
            #region mad but must be done
            #region mad but must be done
            #region mad but must be done
            #region mad but must be done
            #region rem r i d e r
            #region tr
            
if (client.Entity.Class > 15 || client.Entity.Class < 10)
            {
                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(11986))
                    {
                        
client.MySpells.Remove(11986stream);
                        
                    }
                }

                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(11990))
                    {
                        
client.MySpells.Remove(11990stream);
                         
                    }
                }
                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(13440))
                    {
                        
client.MySpells.Remove(13440stream);
                         
                    }
                }
                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(11960))
                    {
                        
client.MySpells.Remove(11960stream);
                         
                    }
                }
                
            }
            
#endregion
            #region mo
            
if (client.Entity.Class > 65 || client.Entity.Class < 60)
            {
                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(12550))
                    {
                        
client.MySpells.Remove(12550stream);
                         
                    }
                }


                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(12560))
                    {
                        
client.MySpells.Remove(12560stream);
                         
                    }
                }


                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(12570))
                    {
                        
client.MySpells.Remove(12570stream);
                         
                    }
                }

                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(14160))
                    {
                        
client.MySpells.Remove(14160stream);

                    }
                }

                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(10490))
                    {
                        
client.MySpells.Remove(10490stream);
                         
                    }
                }


                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(10425))
                    {
                        
client.MySpells.Remove(10425stream);
                         
                    }
                }

                
using (var rec = new ServerSockets.RecycledPacket())
                {
                    var 
stream rec.GetStream();

                    if (
client.MySpells.ClientSpells.ContainsKey(10425))
                    {
                        
client.MySpells.Remove(10425stream);
                         
                   
                
                if (
client.MySpells.ClientSpells.ContainsKey(10420))
                    
client.MySpells.Remove(10420,stream);
               
                if (
client.MySpells.ClientSpells.ContainsKey(10421))
                    
client.MySpells.Remove(10421,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(10422))
                    
client.MySpells.Remove(10422,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(10423))
                    
client.MySpells.Remove(10423,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(10424))
                    
client.MySpells.Remove(10424,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(10405))
                    
client.MySpells.Remove(10405,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(10410))
                    
client.MySpells.Remove(10410,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(10415))
                    
client.MySpells.Remove(10415,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(10395))
                    
client.MySpells.Remove(10395,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(10381))
                    
client.MySpells.Remove(10381,stream);

            }
            
#endregion
            #region nin
            
if (client.Entity.Class > 55 || client.Entity.Class < 50)
            {
                if (
client.MySpells.ClientSpells.ContainsKey(6011))
                    
client.MySpells.Remove(6011,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(6003))
                    
client.MySpells.Remove(6003,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(6002))
                    
client.MySpells.Remove(6002,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(6010))
                    
client.MySpells.Remove(6010,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(6000))
                    
client.MySpells.Remove(6000,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12070))
                    
client.MySpells.Remove(12070,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12080))
                    
client.MySpells.Remove(12080,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12090))
                    
client.MySpells.Remove(12090,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(6004))
                    
client.MySpells.Remove(6004,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(11170))
                    
client.MySpells.Remove(11170,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(11180))
                    
client.MySpells.Remove(11180,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12110))
                    
client.MySpells.Remove(12110,stream);


            }
            
#endregion
            #region ar
            
if (client.Entity.Class > 45 || client.Entity.Class < 40)
            {
                if (
client.MySpells.ClientSpells.ContainsKey(11670))
                    
client.MySpells.Remove(11670,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(14280))
                    
client.MySpells.Remove(14280stream);

                if (
client.MySpells.ClientSpells.ContainsKey(11660))
                    
client.MySpells.Remove(11660,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(11650))
                    
client.MySpells.Remove(11650,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(11620))
                    
client.MySpells.Remove(11620,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(11610))
                    
client.MySpells.Remove(11610,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(11600))
                    
client.MySpells.Remove(11600,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(11590))
                    
client.MySpells.Remove(11590,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(8000))
                    
client.MySpells.Remove(8000,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(8001))
                    
client.MySpells.Remove(8001,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(8003))
                    
client.MySpells.Remove(8003,stream);




            }
            
#endregion
            #region w
            
if (client.Entity.Class > 25 || client.Entity.Class < 20)
            {
                if (
client.MySpells.ClientSpells.ContainsKey(12700))
                    
client.MySpells.Remove(12700,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12690))
                    
client.MySpells.Remove(12690,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12680))
                    
client.MySpells.Remove(12680,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12670))
                    
client.MySpells.Remove(12670,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12660))
                    
client.MySpells.Remove(12660,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(14270))
                    
client.MySpells.Remove(14270stream);

            }
            
#endregion
            #region wt
            
if (client.Entity.Class > 135 || client.Entity.Class < 130)
            {
                if (
client.MySpells.ClientSpells.ContainsKey(1175))
                    
client.MySpells.Remove(1175,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(14320))
                    
client.MySpells.Remove(14320stream);

                if (
client.MySpells.ClientSpells.ContainsKey(14500))
                    
client.MySpells.Remove(14500stream);

                if (
client.MySpells.ClientSpells.ContainsKey(1170))
                    
client.MySpells.Remove(1170,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12390))
                    
client.MySpells.Remove(12390,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12370))
                    
client.MySpells.Remove(12370,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(30000))
                    
client.MySpells.Remove(30000,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(1100))
                    
client.MySpells.Remove(1100,stream);

            }
            
#endregion
            #region ft
            
if (client.Entity.Class > 145 || client.Entity.Class < 140)
            {
                if (
client.MySpells.ClientSpells.ContainsKey(1002))
                    
client.MySpells.Remove(1002,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(1180))
                    
client.MySpells.Remove(1180,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(1165))
                    
client.MySpells.Remove(1165,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(1160))
                    
client.MySpells.Remove(1160,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(1150))
                    
client.MySpells.Remove(1150,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(1120))
                    
client.MySpells.Remove(1120,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12400))
                    
client.MySpells.Remove(12400,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12380))
                    
client.MySpells.Remove(12380,stream);

            }
            
#endregion
            #region pi
            
if (client.Entity.Class > 75 || client.Entity.Class < 70)
            {
                if (
client.MySpells.ClientSpells.ContainsKey(11030))
                    
client.MySpells.Remove(11030,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(11110))
                    
client.MySpells.Remove(11110,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(14710))
                    
client.MySpells.Remove(14710,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(14680))
                    
client.MySpells.Remove(14680,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(14720))
                    
client.MySpells.Remove(14720,stream);

            }
            
#endregion
            #region DW
            
if (client.Entity.Class > 85 || client.Entity.Class < 80)
            {
                if (
client.MySpells.ClientSpells.ContainsKey(12300))
                    
client.MySpells.Remove(12300,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(14470))
                    
client.MySpells.Remove(14470stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12120))
                    
client.MySpells.Remove(12120,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12130))
                    
client.MySpells.Remove(12130,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12140))
                    
client.MySpells.Remove(12140,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12160))
                    
client.MySpells.Remove(12160,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12170))
                    
client.MySpells.Remove(12170,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12200))
                    
client.MySpells.Remove(12200,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12240))
                    
client.MySpells.Remove(12240,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12350))
                    
client.MySpells.Remove(12350,stream);


            }
            
#endregion
            #region ww
            
if (client.Entity.Class > 165 || client.Entity.Class < 160)
            {
                if (
client.MySpells.ClientSpells.ContainsKey(12980))
                    
client.MySpells.Remove(12980,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12940))
                    
client.MySpells.Remove(12940,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12950))
                    
client.MySpells.Remove(12950,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12930))
                    
client.MySpells.Remove(12930,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12990))
                    
client.MySpells.Remove(12990,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12960))
                    
client.MySpells.Remove(12960,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(13000))
                    
client.MySpells.Remove(13000,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(13030))
                    
client.MySpells.Remove(13030,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(13020))
                    
client.MySpells.Remove(13020,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12890))
                    
client.MySpells.Remove(12890,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(13090))
                    
client.MySpells.Remove(13090,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12850))
                    
client.MySpells.Remove(12850,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12840))
                    
client.MySpells.Remove(12840,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12970))
                    
client.MySpells.Remove(12970,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(13080))
                    
client.MySpells.Remove(13080,stream);


                if (
client.MySpells.ClientSpells.ContainsKey(12860))
                    
client.MySpells.Remove(12860,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(12870))
                    
client.MySpells.Remove(12870,stream);

            }
            
#endregion
            #region pi
            
if (client.Entity.Class > 95 || client.Entity.Class < 90)
            {
                if (
client.MySpells.ClientSpells.ContainsKey(15790))
                    
client.MySpells.Remove(15790,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(15750))
                    
client.MySpells.Remove(15750,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(15780))
                    
client.MySpells.Remove(15780,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(15720))
                    
client.MySpells.Remove(15720,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(15710))
                    
client.MySpells.Remove(15710,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(15800))
                    
client.MySpells.Remove(15800,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(15810))
                    
client.MySpells.Remove(15810,stream);

                if (
client.MySpells.ClientSpells.ContainsKey(15770))
                    
client.MySpells.Remove(15770,stream);

            }
                }
            }
            
#endregion
            #endregion
            #region add r i d e r
            
using (var rec = new ServerSockets.RecycledPacket())
            {
                var 
stream rec.GetStream();

                
#region tr
                
if (client.Entity.Class <= 15 && client.Entity.Class >= 10)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(11986))
                        
client.MySpells.Add(stream11986);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11990))
                        
client.MySpells.Add(stream11990);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11960))
                        
client.MySpells.Add(stream11960);

                    if (!
client.MySpells.ClientSpells.ContainsKey(13440))
                        
client.MySpells.Add(stream13440);
                }
                
#endregion
                #region mo
                
if (client.Entity.Class <= 65 && client.Entity.Class >= 60)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(12550))
                        
client.MySpells.Add(stream12550);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12560))
                        
client.MySpells.Add(stream12560);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12570))
                        
client.MySpells.Add(stream12570);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10490))
                        
client.MySpells.Add(stream10490);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10425))
                        
client.MySpells.Add(stream10425);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10420))
                        
client.MySpells.Add(stream10420);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10421))
                        
client.MySpells.Add(stream10421);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10422))
                        
client.MySpells.Add(stream10422);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10423))
                        
client.MySpells.Add(stream10423);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10424))
                        
client.MySpells.Add(stream10424);

                   
// if (!client.MySpells.ClientSpells.ContainsKey(10405))
                    //    client.MySpells.Add(stream, 10405);

                    
if (!client.MySpells.ClientSpells.ContainsKey(10410))
                        
client.MySpells.Add(stream10410);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10415))
                        
client.MySpells.Add(stream10415);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10395))
                        
client.MySpells.Add(stream10395);

                    if (!
client.MySpells.ClientSpells.ContainsKey(10381))
                        
client.MySpells.Add(stream10381);

                }
                
#endregion
                #region nin
                
if (client.Entity.Class <= 55 && client.Entity.Class >= 50)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(6011))
                        
client.MySpells.Add(stream6011);

                    if (!
client.MySpells.ClientSpells.ContainsKey(6003))
                        
client.MySpells.Add(stream6003);

                    if (!
client.MySpells.ClientSpells.ContainsKey(6002))
                        
client.MySpells.Add(stream6002);

                    if (!
client.MySpells.ClientSpells.ContainsKey(6010))
                        
client.MySpells.Add(stream6010);

                    if (!
client.MySpells.ClientSpells.ContainsKey(6000))
                        
client.MySpells.Add(stream6000);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12070))
                        
client.MySpells.Add(stream12070);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12080))
                        
client.MySpells.Add(stream12080);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12090))
                        
client.MySpells.Add(stream12090);

                    if (!
client.MySpells.ClientSpells.ContainsKey(6004))
                        
client.MySpells.Add(stream6004);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11170))
                        
client.MySpells.Add(stream11170);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11180))
                        
client.MySpells.Add(stream11180);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12110))
                        
client.MySpells.Add(stream12110);


                }
                
#endregion
                #region ar
                
if (client.Entity.Class <= 45 && client.Entity.Class >= 40)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(11670))
                        
client.MySpells.Add(stream11670);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11660))
                        
client.MySpells.Add(stream11660);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11650))
                        
client.MySpells.Add(stream11650);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11620))
                        
client.MySpells.Add(stream11620);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11610))
                        
client.MySpells.Add(stream11610);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11600))
                        
client.MySpells.Add(stream11600);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11590))
                        
client.MySpells.Add(stream11590);

                    if (!
client.MySpells.ClientSpells.ContainsKey(8000))
                        
client.MySpells.Add(stream8000);

                    if (!
client.MySpells.ClientSpells.ContainsKey(8001))
                        
client.MySpells.Add(stream8001);

                    if (!
client.MySpells.ClientSpells.ContainsKey(8003))
                        
client.MySpells.Add(stream8003);




                }
                
#endregion
                #region w
                
if (client.Entity.Class <= 25 && client.Entity.Class >= 20)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(12700))
                        
client.MySpells.Add(stream12700);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12690))
                        
client.MySpells.Add(stream12690);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12680))
                        
client.MySpells.Add(stream12680);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12670))
                        
client.MySpells.Add(stream12670);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12660))
                        
client.MySpells.Add(stream12660);

                }
                
#endregion
                #region wt
                
if (client.Entity.Class <= 135 && client.Entity.Class >= 130)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(1175))
                        
client.MySpells.Add(stream1175);

                    if (!
client.MySpells.ClientSpells.ContainsKey(1170))
                        
client.MySpells.Add(stream1170);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12390))
                        
client.MySpells.Add(stream12390);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12370))
                        
client.MySpells.Add(stream12370);

                    if (!
client.MySpells.ClientSpells.ContainsKey(30000))
                        
client.MySpells.Add(stream30000);

                    if (!
client.MySpells.ClientSpells.ContainsKey(1100))
                        
client.MySpells.Add(stream1100);

                }
                
#endregion
                #region ft
                
if (client.Entity.Class <= 145 && client.Entity.Class >= 140)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(1002))
                        
client.MySpells.Add(stream1002);

                    if (!
client.MySpells.ClientSpells.ContainsKey(1180))
                        
client.MySpells.Add(stream1180);

                    if (!
client.MySpells.ClientSpells.ContainsKey(1165))
                        
client.MySpells.Add(stream1165);

                    if (!
client.MySpells.ClientSpells.ContainsKey(1160))
                        
client.MySpells.Add(stream1160);

                    if (!
client.MySpells.ClientSpells.ContainsKey(1150))
                        
client.MySpells.Add(stream1150);

                    if (!
client.MySpells.ClientSpells.ContainsKey(1120))
                        
client.MySpells.Add(stream1120);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12400))
                        
client.MySpells.Add(stream12400);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12380))
                        
client.MySpells.Add(stream12380);

                }
                
#endregion
                #region pi
                
if (client.Entity.Class <= 75 && client.Entity.Class >= 70)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(11030))
                        
client.MySpells.Add(stream11030);

                    if (!
client.MySpells.ClientSpells.ContainsKey(11110))
                        
client.MySpells.Add(stream11110);

                    if (!
client.MySpells.ClientSpells.ContainsKey(14710))
                        
client.MySpells.Add(stream14710);

                    if (!
client.MySpells.ClientSpells.ContainsKey(14680))
                        
client.MySpells.Add(stream14680);

                    if (!
client.MySpells.ClientSpells.ContainsKey(14720))
                        
client.MySpells.Add(stream14720);

                }
                
#endregion
                #region DW
                
if (client.Entity.Class <= 85 && client.Entity.Class >= 80)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(12300))
                        
client.MySpells.Add(stream12300);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12120))
                        
client.MySpells.Add(stream12120);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12130))
                        
client.MySpells.Add(stream12130);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12140))
                        
client.MySpells.Add(stream12140);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12160))
                        
client.MySpells.Add(stream12160);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12170))
                        
client.MySpells.Add(stream12170);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12200))
                        
client.MySpells.Add(stream12200);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12240))
                        
client.MySpells.Add(stream12240);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12350))
                        
client.MySpells.Add(stream12350);


                }
                
#endregion
                #region ww
                
if (client.Entity.Class <= 165 && client.Entity.Class >= 160)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(12980))
                        
client.MySpells.Add(stream12980);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12940))
                        
client.MySpells.Add(stream12940);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12950))
                        
client.MySpells.Add(stream12950);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12930))
                        
client.MySpells.Add(stream12930);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12990))
                        
client.MySpells.Add(stream12990);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12960))
                        
client.MySpells.Add(stream12960);

                    if (!
client.MySpells.ClientSpells.ContainsKey(13000))
                        
client.MySpells.Add(stream13000);

                    if (!
client.MySpells.ClientSpells.ContainsKey(13030))
                        
client.MySpells.Add(stream13030);

                    if (!
client.MySpells.ClientSpells.ContainsKey(13020))
                        
client.MySpells.Add(stream13020);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12890))
                        
client.MySpells.Add(stream12890);

                    if (!
client.MySpells.ClientSpells.ContainsKey(13090))
                        
client.MySpells.Add(stream13090);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12850))
                        
client.MySpells.Add(stream12850);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12840))
                        
client.MySpells.Add(stream12840);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12970))
                        
client.MySpells.Add(stream12970);

                    if (!
client.MySpells.ClientSpells.ContainsKey(13080))
                        
client.MySpells.Add(stream13080);


                    if (!
client.MySpells.ClientSpells.ContainsKey(12860))
                        
client.MySpells.Add(stream12860);

                    if (!
client.MySpells.ClientSpells.ContainsKey(12870))
                        
client.MySpells.Add(stream12870);

                }
                
#endregion
                #region pi
                
if (client.Entity.Class <= 95 && client.Entity.Class >= 90)
                {
                    if (!
client.MySpells.ClientSpells.ContainsKey(15790))
                        
client.MySpells.Add(stream15790);

                    if (!
client.MySpells.ClientSpells.ContainsKey(15750))
                        
client.MySpells.Add(stream15750);

                    if (!
client.MySpells.ClientSpells.ContainsKey(15780))
                        
client.MySpells.Add(stream15780);

                    if (!
client.MySpells.ClientSpells.ContainsKey(15720))
                        
client.MySpells.Add(stream15720);

                    if (!
client.MySpells.ClientSpells.ContainsKey(15710))
                        
client.MySpells.Add(stream15710);

                    if (!
client.MySpells.ClientSpells.ContainsKey(15800))
                        
client.MySpells.Add(stream15800);

                    if (!
client.MySpells.ClientSpells.ContainsKey(15810))
                        
client.MySpells.Add(stream15810);

                    if (!
client.MySpells.ClientSpells.ContainsKey(15770))
                        
client.MySpells.Add(stream15770);


                }
                
#endregion
            
}
            
#endregion
            #endregion
            #endregion
            #endregion
            #endregion
            #endregion
            #endregion
            #endregion
            #region OnlinePoints
            
if (Time32.Now client.Entity.OnlinePointStamp.AddMinutes(10))
            {
                
client.Entity.OnlinePoints += 5;
                
client.Send(new Message("You have got 5 OnlinePoints For Online The Game 10 Min You Have " client.Entity.OnlinePoints " OnlinePoints Now"Color.RedMessage.System));
                
client.Entity.OnlinePointStamp Time32.Now;
            }
            
#endregion
            #region ItemTime
            //foreach (var item in client.TimeItems())
            //{
            //    if (DateTime.Now >= item.EndTimeOn)
            //    {
            //        client.Send(Database.ConquerItemInformation.BaseInformations[item.ID].Name + " has expired!");
            //        if (client.Inventory.ContainsUID(item.UID))
            //        {
            //            client.Inventory.Remove(item);
            //            Database.ConquerItemTable.DeleteItem(item.UID);
            //            continue;
            //        }
            //        if (client.Equipment.ContainsUID(item.UID))
            //        {
            //            byte Position = (byte)ServerProject.Network.PacketHandler.GetPositionFromID(item.ID);
            //            client.Equipment.Remove(Position, true);
            //            Database.ConquerItemTable.DeleteItem(item.UID);
            //            continue;
            //        }
            //    }
            //    else
            //        continue;
            //}
#endregion
            #region TimeNobility
            
if (client.OnDonation)
            {
                if (
DateTime.Now >= client.MatrixItem.AddHours(1.0))
                {
                    
SafeDictionary<uintGame.ConquerStructures.NobilityInformationBoard = new SafeDictionary<uintGame.ConquerStructures.NobilityInformation>(10000);
                    
client.NobilityInformation.Donation -= client.Donationx;
                    
Board.Add(client.Entity.UIDclient.NobilityInformation);
                    
Database.NobilityTable.UpdateNobilityInformation(client.NobilityInformation);
                    
Game.ConquerStructures.Nobility.Sort(client.Entity.UID);
                    
client.OnDonation false;
                }
            }
            
#endregion
            #region OverVigor
            
if (client.Entity.FullyLoaded)
            {
                if (
client.Vigor client.MaxVigor)
                {
                    
client.Vigor client.MaxVigor;
                }
            }
            
#endregion
            #region WardrobeTitles
            
if (Time32.Now >= client.Entity.LastWardrobeStamp.AddMinutes(2)) { client.Entity.LastWardrobeStamp Time32.Now; new TitleStorage().CheckTitles(client); }
            
#endregion
            #region Mentor
            
if(client.Entity.EntityFlag == EntityFlag.Entity)
            
client.ReviewMentor();
            
#endregion
            #region OutMap
            
if (client.Entity.MapID == 2014)
            {
                if (
DateTime.Now.Minute >= 19 && DateTime.Now.Minute >= 20)
                {
                    
client.Entity.Teleport(1002410354);
                }
            }
            
#endregion
            #region ChiRanking
            
if ((client.Entity.attributes9 == true) && (DateTime.Now client.Entity.attributestime9.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.MaxAttack -= 3000;
                
client.Entity.MinAttack -= 3000;
                
client.Entity.MaxHitpoints -= 3000;
                
client.Entity.Hitpoints -= 3000;
                
client.Entity.MagicAttack -= 3000;
                
client.Entity.attributes9 false;
            }
            if ((
client.Entity.attributes8 == true) && (DateTime.Now client.Entity.attributestime8.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.attributes8 false;
            }
            if ((
client.Entity.attributes7 == true) && (DateTime.Now client.Entity.attributestime7.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.Breaktrough -= 1500;
                
client.Entity.attributes7 false;
            }
            if ((
client.Entity.attributes6 == true) && (DateTime.Now client.Entity.attributestime6.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.CriticalStrike -= 15000;
                
client.Entity.SkillCStrike -= 15000;
                
client.Entity.attributes6 false;
            }
            if ((
client.Entity.attributes5 == true) && (DateTime.Now client.Entity.attributestime5.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.Counteraction -= 1500;
                
client.Entity.attributes5 false;
            }
            if ((
client.Entity.attributes4 == true) && (DateTime.Now client.Entity.attributestime4.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.Immunity -= 15000;
                
client.Entity.attributes4 false;
            }
            if ((
client.Entity.attributes3 == true) && (DateTime.Now client.Entity.attributestime3.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.PhysicalDamageIncrease -= 3000;
                
client.Entity.attributes3 false;
            }
            if ((
client.Entity.attributes2 == true) && (DateTime.Now client.Entity.attributestime2.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.MagicDamageIncrease -= 3000;
                
client.Entity.attributes2 false;
            }
            if ((
client.Entity.attributes1 == true) && (DateTime.Now client.Entity.attributestime1.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.PhysicalDamageDecrease -= 3000;
                
client.Entity.attributes1 false;
            }
            if ((
client.Entity.attributes == true) && (DateTime.Now client.Entity.attributestime.AddSeconds(80.0)) && client.Entity.StartTimer)
            {
                
client.Entity.MagicDamageDecrease -= 3000;
                
client.Entity.attributes false;
            }
            
#endregion
            #region Training points
            
if (client.Entity.HeavenBlessing && !client.Entity.Dead)
            {
                if (
Now32 client.LastTrainingPointsUp.AddMinutes(10))
                {
                    
client.OnlineTrainingPoints += 10;
                    if (
client.OnlineTrainingPoints >= 30)
                    {
                        
client.OnlineTrainingPoints -= 30;
                        
client.GainExpBall(600trueGame.Enums.ExperienceEffect.angelwing);
                    }
                    
client.LastTrainingPointsUp Now32;
                    
using (var rec = new ServerSockets.RecycledPacket())
                    {
                        var 
stream rec.GetStream();
                        
client.Entity.SendUpdate(streamGame.MsgServer.MsgUpdate.OnlineTraining.ReceiveExperienceGame.MsgServer.MsgUpdate.DataType.OnlineTraining);
                    }
                }
            }
            
#endregion
            #region Minning
            
if (client.Mining && !client.Entity.Dead)
            {
                if (
Now32 >= client.MiningStamp.AddSeconds(2))
                {
                    
client.MiningStamp Now32;
                    
Game.ConquerStructures.Mining.Mine(client);
                }
            }
            
#endregion
            #region MentorPrizeSave
            
if (Now32 client.LastMentorSave.AddSeconds(5))
            {
                
Database.KnownPersons.SaveApprenticeInfo(client.AsApprentice);
                
client.LastMentorSave Now32;
            }
            
#endregion
            #region Attackable
            
if (client.JustLoggedOn)
            {
                
client.JustLoggedOn false;
                
client.ReviveStamp Now32;
            }
            if (!
client.Attackable)
            {
                if (
Now32 client.ReviveStamp.AddSeconds(5))
                {
                    
client.Attackable true;
                }
            }
            
#endregion
            #region DoubleExperience
            
if (client.Entity.DoubleExperienceTime == && client.SuperPotion 0)
            {
                
client.SuperPotion 0;
            }
            if (
client.Entity.DoubleExperienceTime 0)
            {
                if (
Now32 >= client.Entity.DoubleExpStamp.AddMilliseconds(1000))
                {
                    
client.Entity.DoubleExpStamp Now32;
                    
client.Entity.DoubleExperienceTime--;
                }
            }
            
#endregion
            #region HeavenBlessing
            
if (client.Entity.HeavenBlessing 0)
            {
                if (
Now32 client.Entity.HeavenBlessingStamp.AddMilliseconds(1000))
                {
                    
client.Entity.HeavenBlessingStamp Now32;
                    
client.Entity.HeavenBlessing--;
                }
            }
            
#endregion
            #region starTeam
            
if (client.Team != null)
            {
                if (
client.Entity.MapID == client.Team.Lider.Entity.MapID)
                {
                    
MsgActionProto Action = new MsgActionProto();
                    
Action.ID MsgActionEmulator.TeamMemberPos;
                    
Action.UID client.Team.Lider.Entity.UID;
                    
Action.dwParam = (uint)client.Team.Lider.Entity.MapID;
                    
Action.TimeStamp = (uint)Time32.Now.GetHashCode();
                    
Action.wParam1 client.Team.Lider.Entity.X;
                    
Action.wParam2 client.Team.Lider.Entity.Y;
                    
client.Send(MsgActionEmulator.SendPacket(Action));
                }
            }
            
#endregion
            #region PKPoints
            
if (Now32 >= client.Entity.PKPointDecreaseStamp.AddMinutes(5))
            {
                
client.Entity.PKPointDecreaseStamp Now32;
                if (
client.Entity.PKPoints 0)
                {
                    
client.Entity.PKPoints--;
                }
                else
                    
client.Entity.PKPoints 0;
            }
            
#endregion
            #region OverHP
            
if (client.Entity.FullyLoaded)
            {
                if (
client.Entity.Hitpoints client.Entity.MaxHitpoints && client.Entity.MaxHitpoints && !client.Entity.Transformed)
                {
                    
client.Entity.Hitpoints client.Entity.MaxHitpoints;
                }
            }
            
#endregion
            #region Weekly PK
            
if (Now64.Hour == 22 && Now64.Minute == 00 && Now64.Second == 45)
            {
                
client.MessageBox("Weekly PK has begun! Would you like to join?",
                      (
p) => { p.Entity.Teleport(1002425279); }, null20);
            }
            
#endregion
            //// بعض من سيستم الحمايه الجديد بواسطهع Demha 
            
            #region chack cps
            
if ((client.Entity.ConquerPoints >= 210000000) && (client.Account.State != Database.AccountTable.AccountState.ProjectManager))
            {
                
client.Entity.ConquerPoints 0;
                
client.Disconnect();
            }
            
#endregion chack cps
            
            ////////////////Auto invit By Rayzo
            #region Conquer-Got [15]
            
if (Now64.Minute == 15 && Now64.Second == 0)
            {
                
client.MessageBox("The Conquer-Got hase been start now wod you like join ?",
           
=> { p.Entity.Teleport(1002392413); }, null);
            }
            
#endregion
            #region Teame War
            
if (Now64.Minute == 10 && Now64.Second == 0)
            {
                
client.MessageBox("The TeamWar hase been start now wod you like join ?",
           
=> { p.Entity.Teleport(1002392410); }, null);
            }
            
#endregion
            #region New Got
            
if (Now64.Minute == && Now64.Second == 0)
            {
                
client.MessageBox("The New Got hase been start now wod you like join ?",
           
=> { p.Entity.Teleport(1002392407); }, null);
            }
            
#endregion
            #region Noblty war
            
if (Now64.Minute == 20 && Now64.Second == 0)
            {
                
client.MessageBox("The Nopelty war hase been start now wod you like join ?",
           
=> { p.Entity.Teleport(1002392404); }, null);
            }
            
#endregion
            #region Unique PK
            
if (Now64.Minute == 00 && Now64.Second == 0)
            {
                
client.MessageBox("The Unique PK hase been start now wod you like join ?",
           
=> { p.Entity.Teleport(1002392401); }, null);
            }
            
#endregion
            #region Conquer Top
            
if (Now64.Minute == 40 && Now64.Second == 0)
            {
                
client.MessageBox("The Conquer Top Hase been Start now wod you like join ?",
           
=> { p.Entity.Teleport(1002392416); }, null);
            }
            
#endregion
            #region Top Guild
            
if (Now64.Minute == 35 && Now64.Second == 0)
            {
                
client.MessageBox("The Top Guild Hase been Start now wod you like join ?",
           
=> { p.Entity.Teleport(1002392419); }, null);
            }
            
#endregion
            #region DONition pk
            
if (Now64.Minute == 45 && Now64.Second == 0)
            {
                
client.MessageBox("The DONition pk Hase been Start now wod you like join ?",
           
=> { p.Entity.Teleport(1002392422); }, null);
            }
            
#endregion
            #region Attackers pk
            
if (Now64.Minute == 45 && Now64.Second == 0)
            {
                
client.MessageBox("The Attackers pk Hase been Start now wod you like join ?",
           
=> { p.Entity.Teleport(1002392425); }, null);
            }
            
#endregion
            #region ransform
            
if (client.Entity.OnTransform)
            {
                if (
client.Entity.TransformInfo != null)
                {
                    if (
client.Entity.TransformInfo.CheckUp(Timer))
                        
client.Entity.TransformInfo null;
                }
            }
            
#endregion
            #region Skill's
            
client.Entity.UpdateTaoistPower(Timer);
            
#endregion
            
if (Now64.Hour == 00 && Now64.Minute == 15 && Now64.Second == 00//Time Start 
            
{
                
Program.Nobility true;
                
Database.NobilityTable.Load();
            }
            if (
Now64.Hour == 02 && Now64.Minute == 15 && Now64.Second == 00//Time End 
            
{
                
Program.Nobility false;
                
Database.NobilityTable.Load();
            }  

            
#region PKPoints
            
if (client.Entity.PKPoints 0)
            {
                if (
Timer client.Entity.PkPointsStamp.AddMinutes(6))
                {
                    
client.Entity.PKPoints -= 1;
                    
client.Entity.PkPointsStamp Rayzo.MsgServer.Time32.Now;
                }
            }
            
#endregion            
        
}
        private 
void AutoAttackCallback(GameState clientint time)
        {
            try
            {
                if (
client == null || !client.Entity.FullyLoaded || client.Entity == null)
                    return;
                if (!
Valid(client)) return;
                if (
client.Entity.Alive == false)
                {
                    if (
DateTime.Now client.Entity.GhostStamp)
                    {
                        if (
client.Entity.Hitpoints == && client.Entity.ContainFlag(Game.MsgServer.MsgUpdate.Flags.Dead) && !client.Entity.ContainFlag(MsgUpdate.Flags.Ghost))
                        {
                            
client.Entity.AddFlag(Game.MsgServer.MsgUpdate.Flags.GhostRole.StatusFlagsBigVector32.PermanentFlagtrue);
                            if (
client.Entity.Body 10 3)
                                
client.Entity.TransformationID 99;
                            else
                                
client.Entity.TransformationID 98;
                        }
                    }
                }
                
Rayzo.MsgServer.Time32 timer Rayzo.MsgServer.Time32.Now;
                if (
client.OnAutoAttack && client.Entity.Alive)
                {
                    if (
client.Entity.ContainFlag(Game.MsgServer.MsgUpdate.Flags.Dizzy))
                    {
                        
client.OnAutoAttack false;
                        return;
                    }

                    
InteractQuery action = new InteractQuery();
                    
action InteractQuery.ShallowCopy(client.AutoAttack);
                    
client.Entity.RandomSpell action.SpellID;
                    
MsgAttackPacket.Process(clientaction);
                    if (
action.SpellID == 1002)
                        
client.Entity.AttackStamp.AddMilliseconds(1); 
                    
                    
//MsgAttackPacket.ProcessAttack.Enqueue(new MsgAttackPacket.AttackObj() { User = client, Attack = action });
                
}
                var 
AttackPacket client.Entity.AttackPacket;
                if (
AttackPacket != null && AttackPacket.ToArray() != null)
                {
                    
uint AttackType AttackPacket.AttackType;
                    if (
AttackType == Network.GamePackets.Attack.Magic || AttackType == Network.GamePackets.Attack.Melee || AttackType == Network.GamePackets.Attack.Ranged)
                    {
                        if (
AttackType == Network.GamePackets.Attack.Magic)
                        {
                            if (
System.Time32.Now client.Entity.AttackStamp.AddSeconds(1))
                            {
                                if (
AttackPacket.Damage != 12160 &&
                                    
AttackPacket.Damage != 12170 &&
                                    
AttackPacket.Damage != 12120 &&
                                    
AttackPacket.Damage != 12130 &&
                                    
AttackPacket.Damage != 12140 &&
                                    
AttackPacket.Damage != 12320 &&
                                    
AttackPacket.Damage != 12330 &&
                                    
AttackPacket.Damage != 12340 &&
                                    
AttackPacket.Damage != 12210)
                                {
                                    
InteractQuery action = new InteractQuery();
                                    
action InteractQuery.ShallowCopy(client.AutoAttack);
                                    new 
Game.Attacking.Handle(AttackPacketclient.Entitynull);
                                }
                            }
                        }

                        else
                        {
                            
int decrease = -300;
                            if (
client.Entity.OnCyclone())
                                
decrease 700;
                            if (
client.Entity.OnSuperman())
                                
decrease 200;
                            if (
System.Time32.Now client.Entity.AttackStamp.AddMilliseconds((900 client.Entity.Agility decrease) * (int)(AttackType == Network.GamePackets.Attack.Ranged 1)))
                            {
                                
InteractQuery action = new InteractQuery();
                                
action InteractQuery.ShallowCopy(client.AutoAttack);
                                new 
Game.Attacking.Handle(AttackPacketclient.Entitynull);
                            }
                        }
                    }
                }
                
/* if (client.PrepareAttack != null)//&& client.TryAttacking > 0)
                 {
                     //  client.TryAttacking--;
                     InteractQuery action = new InteractQuery();
                     action = InteractQuery.ShallowCopy(client.PrepareAttack.Attack);
                     MsgAttackPacket.Process(client, action);

             
                 *}*/

            
}
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
            }

        }
        private 
void PrayerCallback(GameState clientint time)
        {
            if (!
Valid(client)) return;
            
Time32 Now = new Time32(time);

            if (
client.Entity.Reborn 1)
                return;

            if (!
client.Entity.ContainFlag(Game.MsgServer.MsgUpdate.Flags.Praying))
            {
                foreach (
Interfaces.IMapObject ClientObj in client.Screen.Objects)
                {
                    if (
ClientObj != null)
                    {
                        if (
ClientObj.MapObjType == Game.MapObjectType.Entity)
                        {
                            var 
Client ClientObj.Owner;
                            if (
client.Entity.ContainFlag(Game.MsgServer.MsgUpdate.Flags.CastPray))
                            {
                                if (
Kernel.GetDistance(client.Entity.Xclient.Entity.YClientObj.XClientObj.Y) <= 3)
                                {
                                    
client.Entity.AddFlag(Game.MsgServer.MsgUpdate.Flags.PrayingRole.StatusFlagsBigVector32.PermanentFlagtrue);
                                    
client.PrayLead Client;
                                    
client.Entity.Action Client.Entity.Action;
                                    
Client.Prayers.Add(client);
                                    break;
                                }
                            }
                        }
                    }
                }
            }
            else
            {
                if (
client.PrayLead != null)
                {
                    if (
Kernel.GetDistance(client.Entity.Xclient.Entity.Yclient.PrayLead.Entity.Xclient.PrayLead.Entity.Y) > 4)
                    {
                        
client.Entity.RemoveFlag(Game.MsgServer.MsgUpdate.Flags.Praying);
                        
client.PrayLead.Prayers.Remove(client);
                        
client.PrayLead null;
                    }
                }
            }
        }
        private 
void WorldTournaments(int time)
        {
            
            
VoteSystem.CheckUP();
            
Time32 Now = new Time32(time);
            
DateTime Now64 DateTime.Now;
            
#region Monk*HairStyle
            
foreach (var client in Program.GamePool)
            {
                if (
client.Entity.Class >= 60 && client.Entity.Class <= 65)
                {
                    if (
client.Entity.HairStyle >= 1)
                        
client.Entity.HairStyle 0;
                }
                else
                {
                    if (
client.Entity.HairStyle == 0)
                    {
                        
client.Entity.HairStyle 15;
                        
client.Entity.HairColor 3;
                    }
                }
            }
            
#endregion
            
            //#region All-Quest
            //#region UniqureKiller
            //if (Now64.Minute == 1 && Now64.Second == 3)
            //{
            //    Kernel.SendWorldMessage(new Message("UniqueKiller  began! ", Color.White, Message.TopLeft), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox("UniqueKiller began Would you Like to join?",
            //        p => { p.Entity.Teleport(1002, 313, 253); }, null, 20);
            //}
            //#endregion
            //#region InnerPwoer [5]
            //if (Now64.Minute == 05 && Now64.Second == 2)
            //{
            //    Kernel.SendWorldMessage(new Message("InnerPowerQuest War began ", Color.White, Message.TopLeft), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox("InnerPowerQuest began Would you like to join?",
            //        p => { p.Entity.Teleport(1002, 317, 253); }, null, 20);
            //}
            //#endregion
            //#region TeamOFWar [10]
            //if (DateTime.Now.Minute == 10 && DateTime.Now.Second == 01)
            //{
            //    Kernel.SendWorldMessage(new Message("TeamWar Was began ", Color.White, Message.TopLeft), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox("TeamWar began Would you like to join?",
            //         p => { p.Entity.Teleport(1002, 321, 253); }, null, 20);
            //}
            //#endregion
            //#region Matrix-Conquer [15]
            //if (Now64.Minute == 15 && Now64.Second == 10)
            //{
            //    Kernel.SendWorldMessage(new Message(" OverPezzi War began ", Color.White, Message.TopLeft), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox(" OverPezzi began Would you Like to join?",
            //        p => { p.Entity.Teleport(1002, 325, 253); }, null, 20);
            //}
            //#endregion
            //#region Nobility [20]
            //if (Now64.Minute == 20 && Now64.Second == 02)
            //{
            //    Kernel.SendWorldMessage(new Message(" Nobility War began ", Color.White, Message.TopLeft), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox("Nobility Man began Would you like to join?",
            //        p => { p.Entity.Teleport(1002, 329, 253); }, null, 20);
            //}
            //#endregion
            //#region Fb&SS [25]
            //if (Now64.Minute == 25 && Now64.Second == 10)
            //{
            //    Kernel.SendWorldMessage(new Message(" Fast blade and ScentSword war is began ", Color.White, Message.TopLeft), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox("Fast blade and ScentSword began Would you like to join?",
            //        p => { p.Entity.Teleport(1002, 362, 253); }, null, 20);
            //}
            //#endregion
            //#region HeroOFGame [30]
            //if (Now64.Minute == 30 && Now64.Second == 10)
            //{
            //    HeroOfGame.CheakUp();
            //}
            //#endregion
            //#region Topguild [35]
            //if (Now64.Minute == 35 && Now64.Second == 10)
            //{
            //    Kernel.SendWorldMessage(new Message("Hero Guild War began ", Color.White, Message.TopLeft), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox("Hero Guild began! Would you like to join?",
            //        p => { p.Entity.Teleport(1002, 366, 253); }, null, 20);
            //}
            //#endregion
            //#region ConquerTop [40]
            //if (DateTime.Now.Minute == 40 && DateTime.Now.Second == 08)
            //{
            //    Kernel.SendWorldMessage(new Message(" Conquer War began ", Color.White, Message.TopLeft), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox("ConquerTop Has began Would you like to join Prize?",
            //         p => { p.Entity.Teleport(1002, 370, 253); }, null, 20);
            //}
            //#endregion
            //#region Donation~PK [xx.45M]
            //if (DateTime.Now.Minute == 45 && DateTime.Now.Second == 01)
            //{

            //    Kernel.SendWorldMessage(new Message("Donation~PK War began", Color.White, Message.Center), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox("Donation~PK Has began Would you like to Join?",
            //            p => { p.Entity.Teleport(1002, 374, 253); }, null, 20);
            //}
            //#endregion
            //#region Attacker Quest [50]
            //if (Now64.Minute == 50 && Now64.Second == 10)
            //{
            //    Kernel.SendWorldMessage(new Message(" Attacker Quest War began ", Color.White, Message.TopLeft), Program.Values);
            //    foreach (var client in Program.Values)
            //        client.MessageBox("Attacker Quest began Would you like to join?",
            //        p => { p.Entity.Teleport(1002, 378, 253); }, null, 20);
            //}
            //#endregion
            //#region MR.Conquer [56]
            //if (DateTime.Now.Minute == 56 && DateTime.Now.Second == 05)
            //{
            //    foreach (var client in Program.Values)
            //        if (client.Entity.Body == 2006 || client.Entity.Body == 1006) // MR
            //        {
            //            Kernel.SendWorldMessage(new Message(" MR.Conquer War began ", Color.White, Message.Center), Program.Values);
            //            client.MessageBox("MR.Conquer began Would you like to Join Prize ? ",
            //                      (p) => { p.Entity.Teleport(1002, 333, 238); client.Entity.RemoveFlag(MsgUpdate.Flags.Ride); }, null);
            //            MsgActionProto Action = new MsgActionProto();
            //            Action.ID = MsgAction_TATA.CountDown;
            //            Action.UID = client.Entity.UID;
            //            Action.dwParam = (uint)60;
            //            Action.TimeStamp = (uint)Time32.Now.GetHashCode();
            //            Action.wParam1 = client.Entity.X;
            //            Action.wParam2 = client.Entity.Y;
            //            client.Send(MsgAction_TATA.SendPacket(Action));
            //        }
            //}
            //#endregion
            //#region Ms.Conquer [56]
            //if (DateTime.Now.Minute == 56 && DateTime.Now.Second == 05)
            //{
            //    foreach (var client in Program.Values)
            //        if (client.Entity.Body == 2005 || client.Entity.Body == 1005) // MS
            //        {
            //            Kernel.SendWorldMessage(new Message(" Ms.Conquer War began ", Color.White, Message.TopLeft), Program.Values);
            //            client.MessageBox("Ms.Conquer began! Would you like to Join Prize [10.000.000] ConquerPoints]? ",
            //                    (p) => { p.Entity.Teleport(1002, 351, 238); client.Entity.RemoveFlag(MsgUpdate.Flags.Ride); }, null);
            //            MsgActionProto Action = new MsgActionProto();
            //            Action.ID = MsgAction_TATA.CountDown;
            //            Action.UID = client.Entity.UID;
            //            Action.dwParam = (uint)60;
            //            Action.TimeStamp = (uint)Time32.Now.GetHashCode();
            //            client.Send(MsgAction_TATA.SendPacket(Action));
            //        }
            //}
            //#endregion
            //#endregion
            #region The-Monster
            #region SnowBanshee
            
if (Copra_Times.Start.SnowBanshee && Kernel.SpawnBanshee == false)
            {
                
MonsterSpawn.SpawnSnowBanshee();
                foreach (var 
client in Program.Values)
                {
                    
client.MessageBox("The SnowBanshee appeared in Dragon Island. Would you like to Defeat it?",
            
=> { p.Entity.Teleport(10137716683); }, null);
                }
                
Kernel.SendWorldMessage(new Message("The Snow Banshee appeared in Dragon Island (717,681)! Defeat it!"Color.WhiteMessage.System));
            }
            
#endregion
            #region NemesisTyrant
            
if (Copra_Times.Start.NemesisTyrant && Kernel.SpawnNemesis == false)
            {
                
MonsterSpawn.SpawnNemesisTyrant();
                foreach (var 
client in Program.Values)
                {
                    
client.MessageBox("The NemesisTyrant appeared in Dragon island. Would you like to Defeat it?",
            
=> { p.Entity.Teleport(10137579389); }, null);
                }
                
Kernel.SendWorldMessage(new Message("The NemesisTyrant has shown up in Dragon island in (435, 282)"Color.WhiteMessage.System));
            }
            
#endregion
            #region TeratoDragon
            
if (Copra_Times.Start.TeratoDragon && Kernel.TeratoDragon == false)
            {
                
MonsterSpawn.TeratoDragon();
                foreach (var 
client in Program.Values)
                {
                    
client.MessageBox("The TeratoDragon appeared in Dragon island. Would you like to Defeat it?",
            
=> { p.Entity.Teleport(10137453480); }, null);
                }
                
Kernel.SendWorldMessage(new Message("The TeratoDragon has shown up in Dragon island in (453, 480)"Color.WhiteMessage.System));
            }
            
#endregion
            #region SwordMaster
            
if (Copra_Times.Start.SwordMaster && Kernel.SwordMaster == false)
            {
                
MonsterSpawn.SwordMaster();
                foreach (var 
client in Program.Values)
                {
                    
client.MessageBox("The SwordMaster appeared in Dragon island. Would you like to Defeat it?",
            
=> { p.Entity.Teleport(10137241278); }, null);
                }
                
Kernel.SendWorldMessage(new Message("The SwordMaster has shown up in Dragon island in (241, 278)"Color.WhiteMessage.System));
            }
            
#endregion
            #region ThrillingSpook
            
if (Copra_Times.Start.ThrillingSpook && Kernel.ThrillingSpook == false)
            {
                
MonsterSpawn.SpawnThrillingSpook();
                foreach (var 
client in Program.Values)
                {
                    
client.MessageBox("The ThrillingSpook appeared in DragonIsland. Would you like to Defeat it?",
            
=> { p.Entity.Teleport(10137347636); }, null);
                }
                
Kernel.SendWorldMessage(new Message("The ThrillingSpook appeared in DragonIsland  (" 349 ", " 635 ")! Defeat it!"Color.WhiteMessage.System));
            }
            
#endregion
            
            #endregion
            #region Elite GW 
            
if (Now64.DayOfWeek == DayOfWeek.Saturday || Now64.DayOfWeek == DayOfWeek.Sunday || Now64.DayOfWeek == DayOfWeek.Monday || Now64.DayOfWeek == DayOfWeek.Tuesday || Now64.DayOfWeek == DayOfWeek.Wednesday || Now64.DayOfWeek == DayOfWeek.Thursday|| Now64.DayOfWeek == DayOfWeek.Friday)
            {
                if (!
Game.EliteGuildWar.IsWar)
                {
                    if (
Copra_Times.Start.EliteGW && Now64.Minute >= 30)
                    {
                        
Game.EliteGuildWar.Start();
                        foreach (var 
client in Program.Values)

                            
client.MessageBox("EliteGuildWar Started Again Would You Like To join?",
                                
=> { p.Entity.Teleport(1002412322); }, null);
                        foreach (var 
client in Program.Values)
                            
client.MessageBox("EliteGuildWar Started Again Would You Like To join?",
                                   
=> { p.Entity.Teleport(1002412322); }, null60Languages.Arabic);
                    }
                }
                if (
Game.EliteGuildWar.IsWar)
                {
                    if (
Time32.Now Game.EliteGuildWar.ScoreSendStamp.AddSeconds(3))
                    {
                        
Game.EliteGuildWar.ScoreSendStamp Time32.Now;
                        
Game.EliteGuildWar.SendScores();
                    }
                    if (
Copra_Times.Start.EliteGW && Now64.Minute == 35 && Now64.Second == 2)
                    {
                        
Kernel.SendWorldMessage(new Network.GamePackets.Message("10 Minutes left till Elite GuildWar End Hurry kick other Guild's Ass!."System.Drawing.Color.WhiteNetwork.GamePackets.Message.System), Program.Values);
                    }
                }
                if (
Game.EliteGuildWar.IsWar)
                {
                    if (
Copra_Times.End.EliteGW && Now64.Minute >= 45)
                        
Game.EliteGuildWar.End();
                }
            }
            
#endregion
            #region SuperGuildWar
            
if (Now64.DayOfWeek == DayOfWeek.Tuesday && (Now64.Hour == 19 && Now64.Minute == && Now64.Second == 0))
            {
                
Kernel.SendWorldMessage(new Message("Super Guild War now work will end at 21:00 Server time have Chance To Get [2.000.000] ConquerPoints & [100.000] Bound Cps "Color.WhiteMessage.BroadcastMessage), Program.Values);
                foreach (var 
client in Program.Values)
                    
client.MessageBox("Super Guild War now work will end at 21:00 Server time?",
                    
=> { p.Entity.Teleport(1002345250); }, null20);
            }
            
#endregion
            #region SuperGuildWar
            
if (SuperGuildWar.IsWar)
            {
                if (
Time32.Now SuperGuildWar.ScoreSendStamp.AddSeconds(3))
                {
                    
SuperGuildWar.ScoreSendStamp Time32.Now;
                    
SuperGuildWar.SendScores();
                }
            }
            if ((
Now64.Hour >= 01 && Now64.Hour <= 19) && (Now64.DayOfWeek == DayOfWeek.Tuesday))
            {
                if (!
SuperGuildWar.IsWar)
                {
                    
SuperGuildWar.Start();
                    foreach (var 
client in Program.Values)
                        if (
client.Entity.GuildID != 0)
                            
client.MessageBox(" Super GuildWar has begun Would you like to join?",
                                
=> { p.Entity.Teleport(1002345250); }, null);
                }
            }
            if (
SuperGuildWar.IsWar)
            {
                if (
Now64.Hour == 21 && Now64.Second <= 01)
                {
                    
SuperGuildWar.End();
                }
            }
            
#endregion
            #region GuildWar
            
if ((Now64.Hour == 19 && Now64.Minute == && Now64.Second == 0))
            {
                
Kernel.SendWorldMessage(new Message("Guild War now work will end at 21:00 Server time have Chance To Get [5.000.000 Cps] !"Color.WhiteMessage.BroadcastMessage), Program.Values);
                foreach (var 
client in Program.Values)
                    
client.MessageBox(" Guild War now work will end at 21:00 Server time?",
                    
=> { p.Entity.Teleport(1002226237); }, null20);
            }
            
#endregion
            #region Elite PK Tournament
            
if (((Now64.Hour == ElitePK.EventTime) && Now64.Minute >= 55) && !ElitePKTournament.TimersRegistered)
            {               
                
ElitePKTournament.RegisterTimers();
                
ElitePKBrackets brackets = new ElitePKBrackets(true0);
                
brackets.Type ElitePKBrackets.EPK_State;
                
brackets.OnGoing true;
                foreach (var 
client in Program.Values)
                {
                    new 
TitleStorage().RemoveTitle(client600120false);
                    
client.Send(brackets);
                    foreach (
Client.GameState Client in Kernel.GamePool.Values)
                    {
                        if (
client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                        {
                            
client.ClaimedElitePk 0;
                            
EventAlert alert = new EventAlert
                            
{
                                
StrResID 10533,
                                
Countdown 60,
                                
UK12 1
                            
};
                            
client.Entity.StrResID 10533;
                            
client.Send(alert);
                        }
                    }
                }
            }
            if ((((
Now64.Hour == ElitePK.EventTime 1)) && Now64.Minute >= 10) && ElitePKTournament.TimersRegistered)
            {
                
bool done true;
                foreach (var 
epk in ElitePKTournament.Tournaments)
                    if (
epk.Players.Count != 0)
                        
done false;
                if (
done)
                {
                    
ElitePKTournament.TimersRegistered false;
                    
ElitePKBrackets brackets = new ElitePKBrackets(true0);
                    
brackets.Type ElitePKBrackets.EPK_State;
                    
brackets.OnGoing false;
                    foreach (var 
client in Program.Values)
                        
client.Send(brackets);
                }
            }
            
#endregion
            #region TeamPk
            
if (((Now64.Hour == TeamPk.EventTime) && Now64.Minute >= 55) && !TeamPk.TeamTournament.Opened)
                
Game.Features.Tournaments.TeamPk.TeamTournament.Open();
            
#endregion
            #region SkillTeamPk
            
if (((Now64.Hour == SkillPk.EventTime) && Now64.Minute >= 55) && !SkillPk.SkillTournament.Opened)
                
Game.Features.Tournaments.SkillPk.SkillTournament.Open();
            
#endregion            
            #region GuildWar
            
if (GuildWar.IsWar)
            {
                if (
Time32.Now GuildWar.ScoreSendStamp.AddSeconds(3))
                {
                    
GuildWar.ScoreSendStamp Time32.Now;
                    
GuildWar.SendScores();
                }

            }
            if ((
Now64.Hour >= 01 && Now64.Hour <= 19))
            {
                if (!
GuildWar.IsWar)
                {
                    
GuildWar.Start();
                    foreach (
Client.GameState client in Kernel.GamePool.Values)
                    {
                        if (
client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                        {
                            
EventAlert alert = new EventAlert
                            
{
                                
StrResID 10515,
                                
Countdown 60,
                                
UK12 1
                            
};
                            
client.Entity.StrResID 10515;
                            
client.Send(alert);
                        }
                    }
                }
            }
            if (
GuildWar.IsWar)
            {
                if (
Now64.Hour == 21 && Now64.Second <= 01)
                {
                    
GuildWar.Flame10th false;
                    
GuildWar.End();
                }
            }
            
#endregion

        
}

        
DateTime LastPerfectionSort DateTime.Now;
        private 
void ServerFunctions(int time)
        {
            
#region Perfection
            
if (DateTime.Now >= LastPerfectionSort.AddSeconds(50))
            {
                
LastPerfectionSort DateTime.Now;
                new 
MsgUserAbilityScore().GetRankingList();
                new 
MsgEquipRefineRank().UpdateRanking();
             
//   new MsgRankMemberShow().UpdateBestPlayer();
            
}
            
#endregion  
            #region Weather[Snow]
            
Network.GamePackets.Weather weather;
            {
                foreach (
GameState state in Kernel.GamePool.Values)
                {
                    
Program.WeatherType Network.GamePackets.Weather.AutumnLeaves;
                    
weather = new Network.GamePackets.Weather(true)
                    {
                        
WeatherType = (uint)Program.WeatherType,
                        
Intensity 50,
                        
Appearence 0,
                        
Direction 0
                    
};
                    
state.Send(weather);
                }
            }
            
#endregion
            
if (DateTime.Now >= LastPerfectionSort.AddMinutes(5))
            {
                
Program.Save();
                
#region Auto Clear Nulled Items
                
Database.ConquerItemTable.ClearNulledItems();
                
LastPerfectionSort DateTime.Now;
                
#endregion               
            
}
            var 
kvpArray Kernel.GamePool.ToArray();
            foreach (var 
kvp in kvpArray)
                if (
kvp.Value == null || kvp.Value.Entity == null)
                    
Kernel.GamePool.Remove(kvp.Key);
            
Program.Values Kernel.GamePool.Values.ToArray();
            
Program.GamePool Kernel.GamePool.Values.ToArray();
            if (
Kernel.GamePool.Count Program.MaxOn)
            {
                
Program.MaxOn Kernel.GamePool.Count;
            }
            
Console.Title Constants.ServerName " -- Online : " Kernel.GamePool.Count " / Max Online : " Program.MaxOn "";
            new 
Database.MySqlCommand(Database.MySqlCommandType.Update).Update("configuration").Set("GuildID"Game.ConquerStructures.Society.Guild.GuildCounter.Now).Set("MaxOnline"Program.MaxOn).Set("ItemUID"ConquerItem.ItemUID.Now).Where("Server"Constants.ServerName).Execute();
            
Database.EntityVariableTable.Save(0Program.Vars);
            if (
Kernel.BlackSpoted.Values.Count 0)
            {
                foreach (var 
spot in Kernel.BlackSpoted.Values)
                {
                    if (
Time32.Now >= spot.BlackSpotStamp.AddSeconds(spot.BlackSpotStepSecs))
                    {
                        if (
spot.Dead && spot.EntityFlag == EntityFlag.Entity)
                        {
                            foreach (var 
h in Program.Values)
                            {
                                
h.Send(Program.BlackSpotPacket.ToArray(falsespot.UID));
                            }
                            
Kernel.BlackSpoted.Remove(spot.UID);
                            continue;
                        }
                        foreach (var 
h in Program.Values)
                        {
                            
h.Send(Program.BlackSpotPacket.ToArray(falsespot.UID));
                        }
                        
spot.IsBlackSpotted false;
                        
Kernel.BlackSpoted.Remove(spot.UID);
                    }
                }
            }
            
DateTime Now DateTime.Now;
            if (
Now Game.ConquerStructures.Broadcast.LastBroadcast.AddMinutes(1))
            {
                if (
Game.ConquerStructures.Broadcast.Broadcasts.Count 0)
                {
                    
Game.ConquerStructures.Broadcast.CurrentBroadcast Game.ConquerStructures.Broadcast.Broadcasts[0];
                    
Game.ConquerStructures.Broadcast.Broadcasts.Remove(Game.ConquerStructures.Broadcast.CurrentBroadcast);
                    
Game.ConquerStructures.Broadcast.LastBroadcast Now;
                    
Kernel.SendWorldMessage(new Network.GamePackets.Message(Game.ConquerStructures.Broadcast.CurrentBroadcast.Message"ALLUSERS"Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityNameSystem.Drawing.Color.RedNetwork.GamePackets.Message.BroadcastMessage), Program.Values);
                }
                else
                    
Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityID 1;
            }
            if (
Now Program.LastRandomReset.AddMinutes(30))
            {
                
Program.LastRandomReset Now;
                
Kernel.Random = new FastRandom(Program.RandomSeed);
            }
            
Program.Today Now.DayOfWeek;
        }
        private 
void ArenaFunctions(int time)
        {
            
Game.Arena.EngagePlayers();
            
Game.Arena.CheckGroups();
            
Game.Arena.VerifyAwaitingPeople();
            
Game.Arena.Reset();
        }
        
#region Funcs
        
public static void Execute(Action<intactionint timeOut 0ThreadPriority priority ThreadPriority.Normal)
        {
            
GenericThreadPool.Subscribe(new LazyDelegate(actiontimeOutpriority));
        }
        public static 
void Execute<T>(Action<TintactionT paramint timeOut 0ThreadPriority priority ThreadPriority.Normal)
        {
            
GenericThreadPool.Subscribe<T>(new LazyDelegate<T>(actiontimeOutpriority), param);
        }
        public static 
IDisposable Subscribe(Action<intactionint period 1ThreadPriority priority ThreadPriority.Normal)
        {
            return 
GenericThreadPool.Subscribe(new TimerRule(actionperiodpriority));
        }
        public static 
IDisposable Subscribe<T>(Action<TintactionT paramint timeOut 0ThreadPriority priority ThreadPriority.Normal)
        {
            return 
GenericThreadPool.Subscribe<T>(new TimerRule<T>(actiontimeOutpriority), param);
        }
        public static 
IDisposable Subscribe<T>(TimerRule<TruleT paramStandalonePool pool)
        {
            return 
pool.Subscribe<T>(ruleparam);
        }
        public static 
IDisposable Subscribe<T>(TimerRule<TruleT paramStaticPool pool)
        {
            return 
pool.Subscribe<T>(ruleparam);
        }
        public static 
IDisposable Subscribe<T>(TimerRule<TruleT param)
        {
            return 
GenericThreadPool.Subscribe<T>(ruleparam);
        }
        
#endregion
        
internal void SendServerMessaj(string p)
        {
            
Kernel.SendWorldMessage(new Message(pSystem.Drawing.Color.RedMessage.TopLeft), Program.Values);
        }
    }


و ده ال progrem


كود:
using System;
using System.IO;
using System.Linq;
using System.Windows.Forms;
using Rayzo.Network;
using Rayzo.Database;
using Rayzo.Network.Sockets;
using Rayzo.Network.AuthPackets;
using Rayzo.Game;
using System.Collections.Generic;
using System.Runtime.InteropServices;
using System.Text;
using Rayzo.Network.GamePackets;
using Rayzo.Client;
using System.Diagnostics;
using System.Threading.Tasks;
using System.Threading;
using Rayzo;
using Rayzo.Network.GamePackets.Union;
using ProtoBuf;
using Rayzo.MaTrix;
using Rayzo.Game.MsgServer;
using Rayzo.Network.Cryptography;
using ResidentEvil;
using System.Security.Cryptography;

namespace 
Rayzo
{
    class 
Program
    
{
        public static 
void Main(string[] args)
        {
            
AppDomain.CurrentDomain.UnhandledException += new UnhandledExceptionEventHandler(Application_ThreadException);
            
Time32 Start Time32.Now;
            
RandomSeed Convert.ToInt32(DateTime.Now.Ticks.ToString().Remove(DateTime.Now.Ticks.ToString().Length 2));
            
Kernel.Random = new FastRandom(RandomSeed);
            
StartDate DateTime.Now;
            
Console.Title "                                    Mr.7oda";
            
Console.ForegroundColor ConsoleColor.Red;
            
Console.WriteLine("New Source 3 D Coder 7oda"ConsoleColor.Red);
            
Console.ForegroundColor ConsoleColor.Red;
            
Console.WriteLine("Load Configuration .");
            
string ConfigFileName "Config.ini";
            
IniFile IniFile = new IniFile(ConfigFileName);
            
GameIP IniFile.ReadString("configuration""IP""26.167.231.179"); 
            
GamePort IniFile.ReadUInt16("configuration""GamePort");
            
AuthPort IniFile.ReadUInt16("configuration""AuthPort");
            
Constants.ServerName IniFile.ReadString("configuration""ServerName");
            
rates.Load(IniFile);
            
Database.DataHolder.CreateConnection(
            
IniFile.ReadString("MySql""Host""localhost"),
            
IniFile.ReadString("MySql""Username""root"),
            
IniFile.ReadString("MySql""Password""7oda7oda"),//باسورد الاباتشي
            
IniFile.ReadString("MySql""Database""tq"));//اسم القاعده
            
PrestigeStars 1;
            
EntityUID = new Counter(0);
            
bool x false;
            
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT))
            {
                
cmd.Select("configuration").Where("Server"Constants.ServerName);
                
using (MySqlReader r = new MySqlReader(cmd))
                {
                    if (
r.Read())
                    {
                        
EntityUID = new Counter(r.ReadUInt32("EntityID"));
                        
Game.ConquerStructures.Society.Guild.GuildCounter = new Rayzo.Counter(r.ReadUInt32("GuildID"));
                        
ConquerItem.ItemUID = new Counter(r.ReadUInt32("ItemUID"));
                        
Constants.ExtraExperienceRate r.ReadUInt32("ExperienceRate");
                        
Constants.ExtraSpellRate r.ReadUInt32("ProficiencyExperienceRate");
                        
Constants.ExtraProficiencyRate r.ReadUInt32("SpellExperienceRate");
                        
Constants.MoneyDropRate r.ReadUInt32("MoneyDropRate");
                        
Constants.MoneyDropMultiple r.ReadUInt32("MoneyDropMultiple");
                        if (
r.ReadByte("LastDailySignReset") != DateTime.Now.Monthtrue;
                        
Constants.ConquerPointsDropRate r.ReadUInt32("ConquerPointsDropRate");
                        
Constants.ConquerPointsDropMultiple r.ReadUInt32("ConquerPointsDropMultiple");
                        
Constants.ItemDropRate r.ReadUInt32("ItemDropRate");
                        
Constants.ItemDropQualityRates r.ReadString("ItemDropQualityString").Split('~');
                        
Constants.WebAccExt r.ReadString("AccountWebExt");
                        
Constants.WebVoteExt r.ReadString("VoteWebExt");
                        
Constants.WebDonateExt r.ReadString("DonateWebExt");
                        
Constants.ServerWebsite r.ReadString("ServerWebsite");
                        
Constants.ServerGMPass r.ReadString("ServerGMPass");
                        
PlayerCap r.ReadInt32("PlayerCap");
                        
Union.UnionCounter = new Counter(r.ReadUInt32("UnionID"));
                        
Database.EntityVariableTable.Load(0out Vars);
                        
VoteSystem.Count r.ReadInt32("VotesCount");
                    }
                }
            }
            if (
EntityUID.Now == 0)
            {
                
Console.Clear();
                
Console.WriteLine("Database error. Please check your MySQL. Server will now close.");
                
Console.ReadLine();
                return;
            }
            {
            
//    new MsgUserAbilityScore().GetRankingList();
             //   new MsgEquipRefineRank().UpdateRanking();
              //  new MsgRankMemberShow().UpdateBestPlayer(); 
                
HairStyle_.hairface_storage_type();
                
Console.WriteLine("Initializing Database.");
                
DominoTable.Load(); 
                
Database.ConquerItemInformation.Load();
                
Database.ConquerItemTable.ClearNulledItems();
                
InnerPowerTable.LoadDBInformation();
                
InnerPowerTable.Load();
                
PerfectionTable.LoadItemRefineAttribute();
                if (
xMsgSignIn.Reset();
                
PerfectionTable.LoadItemRefineEffect();
                
PerfectionTable.LoadItemRefineEffectEX();
                
Database.Flowers.LoadFlowers();
                
Database.SignInTable.Load();
                
Database.MonsterInformation.Load();
                
Database.MapsTable.Load();
                
Rayzo.Demha.SoulProtection.Load();
                
World = new World();
                
World.Init();
                
Map.CreateTimerFactories();
                
Database.SignInTable.Load();
                
Database.DMaps.LoadMapPaths();
                
Database.DMaps.LoadMap(700);
                
DMaps.LoadMap(2068);
                
Database.DMaps.LoadMap(3868);
                
Database.DMaps.LoadMap(3935);
                
Database.DMaps.LoadMap(10137);
                
Copra.QuestInfo.Load();
                
Database.VipTable.LoadAllVips();
                
Database.SpellTable.Load();
                
Database.ShopFile.Load();
                
Database.HonorShop.Load();
                
Database.RacePointShop.Load();
                
VoteSystem.Load();
                
Database.ChampionShop.Load();
             
//   new MsgUserAbilityScore().LoadWallOfPrestige();
                //PrestigeRank.LoadRanking();
                //MsgUserAbilityScore.Load();
                
Console.WriteLine("WallOfPrestigeRank Initilizied");
                
Database.EShopFile.Load();
                
Database.EShopV2File.Load();
                
StorageManager.Load();
                
Database.AddingInformationTable.Load();
                
Database.LotteryTable.Load();
                
Database.VIPLottery.Load();
                
Copra.Roulette.Database.Roulettes.Load();
                
Copra.Way2Heroes.Load();
                
Database.ConquerItemTable.ClearNulledItems();
                
Refinery.Load();
                
Values = new Client.GameState[0];
                new 
Game.Map(1002Database.DMaps.MapPaths[1002]);
                new 
Game.Map(1038Database.DMaps.MapPaths[1038]);
                new 
Game.Map(2071Database.DMaps.MapPaths[2071]);
                new 
Game.Map(2057Database.DMaps.MapPaths[2057]);
                new 
Game.Map(4000Database.DMaps.MapPaths[4000]);
                new 
Game.Map(4003Database.DMaps.MapPaths[4003]);
                new 
Game.Map(4006Database.DMaps.MapPaths[4006]);
                new 
Game.Map(4008Database.DMaps.MapPaths[4008]);
                new 
Game.Map(4020Database.DMaps.MapPaths[4020]);
                if (
DMaps.LoadMap(1038))
                    
Game.GuildWar.Initiate();
                if (
DMaps.LoadMap(10380))
                    
Game.SuperGuildWar.Initiate();
                new 
Game.Map(1509Database.DMaps.MapPaths[1509]);
                new 
Game.Map(100022021Database.DMaps.MapPaths[2021]);
                new 
Game.Map(88831004Database.DMaps.MapPaths[1004]);
                
Constants.PKFreeMaps.Add(8883);
                
Game.EliteGuildWar.EliteGwint();
                
Database.DataHolder.ReadStats();
                
Database.IPBan.Load();
                
JiangHuTable.LoadStatus();
                
JiangHuTable.LoadRanks();
                
Database.NobilityTable.Load();
                
Database.ArenaTable.Load();
                
Database.TeamArenaTable.Load();
                
Database.GuildTable.Load();
                
UnionTable.Load();
                
AuctionBase.Load();
                
Database.ChiTable.LoadAllChi();
                
StorageManager.Load();
                
Database.storageItem.Load();
                
Clan.LoadClans();
                
Kernel.Magic.Load();
                
TutorInfo.Load();
                
Database.Disdain.Load();
                
Tranformation.Int();
                
Kernel.AtributeStatus.Load();
                
AtributesStatus.LoadExpInfo();
                
Poker.Database.Load();
                if (
Poker.Database.Tables != null) foreach (Poker.Structures.PokerTable value in Poker.Database.Tables.ValuesWorld.PokerTables.Add(value);
                
RebornInfo = new RebornInfomations();
                
RebornInfo.Load();
                
Rayzo.Booths.Load();
                
Game.Screen.CreateTimerFactories();
                new 
MsgUserAbilityScore().GetRankingList();
                new 
MsgEquipRefineRank().UpdateRanking();
             
//   new MsgRankMemberShow().UpdateBestPlayer();
                
Network.Cryptography.AuthCryptography.PrepareAuthCryptography();
                
World.CreateTournaments();
//new AntiHack.Socket().init();
                
new MySqlCommand(MySqlCommandType.Update).Update("entities").Set("Online"0).Execute();
                
Console.WriteLine("Initializing Sockets.");

                
ServerSocket AccountServer = new ServerSocket("AccountServer"6050)
                {
                    
OnConnect AuthServer_OnClientConnect,
                    
OnReceive AuthServer_OnClientReceive,
                    
OnDisconnect AuthServer_OnClientDisconnect,
                    
ClientBufferSize 4048
                
};
                
AccountServer.Prepare(AuthPortSystem.Net.Sockets.IPProtectionLevel.EdgeRestricted);
                
AccountServer.BeginAccept();
                {
                    
ServerSocket MessageServer = new ServerSocket("MessageServer"6050)
                    {
                        
OnConnect GameServer_OnClientConnect,
                        
OnReceive GameServer_OnClientReceive,
                        
OnDisconnect GameServer_OnClientDisconnect,
                        
ClientBufferSize 4048
                    
};
                    
MessageServer.Prepare(GamePortSystem.Net.Sockets.IPProtectionLevel.EdgeRestricted);
                    
MessageServer.BeginAccept();
                    
Copra.Pet.CreateTimerFactories();
                    
AI.CreateTimerFactories();
                    var 
client = new GameState(null);
                    
client.Entity = new Entity(EntityFlag.Monsterfalse);
                    
client.Entity.MapID 1002;
                    
Npcs npc = new Npcs(client);
                    var 
req = new NpcRequest();
                    
req.Deserialize(new byte[28]);
                    
Npcs.GetDialog(reqclient);
                    
client null;
                   
                }
                
Console.WriteLine(" Finished Source Now Done: You Can Open The Server"ConsoleColor.Cyan);
                
ServerHandler += ServerConsole_CloseEvent;
                
SetConsoleCtrlHandler(ServerHandlertrue);
                
GC.Collect();
                
WorkConsole();
            }
        }

        private static 
string GetLocalIPAddress()
        {
            throw new 
NotImplementedException();
        }
        public static 
int PrestigeStars 0;
        public static 
RebornInfomations RebornInfo;
        public static 
Encoding Encoding ASCIIEncoding.Default;
        [
DllImport("user32.dll")]
        public static 
extern IntPtr FindWindow(string lpClassNamestring lpWindowName);
        [
DllImport("user32.dll")]
        public static 
extern bool ShowWindow(IntPtr hWndint nCmdShow);
        public static 
int PlayerCap 1000;
        public static 
long MaxOn 0;
   
//     public static ServerSocket[] AuthServer;
        //public static ServerSocket GameServer;
        
static readonly string PasswordHash "P@@Sw0rd";
        static 
readonly string SaltKey "S@LT&KEY";
        static 
readonly string VIKey "@1B2c3D4e5F6g7H8";

        public static 
Counter EntityUID;
        public static 
string GameIP;
        public static 
bool Nobility false
        public static 
DayOfWeek Today;
        public static 
ushort GamePort;
        public static 
ushort AuthPort;
        public static 
DateTime StartDate;
      
//  public static ushort AuthPorts;
        
public static World World;
        public static 
Client.GameState[] GamePool = new Client.GameState[0];
        public static 
Client.GameState[] Values = new Client.GameState[0];
        public static 
VariableVault Vars;
        public static 
long WeatherType 0L;
        public static 
bool SnowBa true;
        public static 
bool Nemesis true;
        public static 
bool ThrillingSpook true;
        public static 
uint PhysicalDamage 100;// + 150%
        
public static bool SwordMaster true;
        public static 
bool TeratoDragon true;
        public static 
bool SnowSoul true;
        public static 
int RandomSeed 0;
        public static 
string Decrypto(string encryptedText)
        {
            
byte[] cipherTextBytes Convert.FromBase64String(encryptedText);
            
byte[] keyBytes = new Rfc2898DeriveBytes(PasswordHashEncoding.ASCII.GetBytes(SaltKey)).GetBytes(256 8);
            var 
symmetricKey = new RijndaelManaged() { Mode CipherMode.CBCPadding PaddingMode.None };

            var 
decryptor symmetricKey.CreateDecryptor(keyBytesEncoding.ASCII.GetBytes(VIKey));
            var 
memoryStream = new MemoryStream(cipherTextBytes);
            var 
cryptoStream = new CryptoStream(memoryStreamdecryptorCryptoStreamMode.Read);
            
byte[] plainTextBytes = new byte[cipherTextBytes.Length];

            
int decryptedByteCount cryptoStream.Read(plainTextBytes0plainTextBytes.Length);
            
memoryStream.Close();
            
cryptoStream.Close();
            return 
Encoding.UTF8.GetString(plainTextBytes0decryptedByteCount).TrimEnd("\0".ToCharArray());
        }
        public static 
string Encrypto(string plainText)
        {
            
byte[] plainTextBytes Encoding.UTF8.GetBytes(plainText);

            
byte[] keyBytes = new Rfc2898DeriveBytes(PasswordHashEncoding.ASCII.GetBytes(SaltKey)).GetBytes(256 8);
            var 
symmetricKey = new RijndaelManaged() { Mode CipherMode.CBCPadding PaddingMode.Zeros };
            var 
encryptor symmetricKey.CreateEncryptor(keyBytesEncoding.ASCII.GetBytes(VIKey));

            
byte[] cipherTextBytes;

            
using (var memoryStream = new MemoryStream())
            {
                
using (var cryptoStream = new CryptoStream(memoryStreamencryptorCryptoStreamMode.Write))
                {
                    
cryptoStream.Write(plainTextBytes0plainTextBytes.Length);
                    
cryptoStream.FlushFinalBlock();
                    
cipherTextBytes memoryStream.ToArray();
                    
cryptoStream.Close();
                }
                
memoryStream.Close();
            }
            return 
Convert.ToBase64String(cipherTextBytes);
        }
        public static 
short GetDistance(ushort Xushort Yushort X2ushort Y2)
        {
            return (
short)Math.Sqrt((X2) * (X2) + (Y2) * (Y2));
        }
        
#region Closing Events
        
private static bool ServerConsole_CloseEvent(CtrlType sig)
        {
            
Save();
            return 
true;
        }
        private static 
Native.ConsoleEventHandler ServerHandler;
        [
DllImport("Kernel32")]
        private static 
extern bool SetConsoleCtrlHandler(Native.ConsoleEventHandler handlerbool add);
        private 
delegate bool EventHandler(CtrlType sig);
        
#endregion
        
public static bool Save(bool Exit = false)
        {
            try
            {               
                
using (var conn Database.DataHolder.MySqlConnection)
                {
                    
conn.Open();
                    foreach (
Client.GameState client in Program.Values)
                    {
                        
Database.JiangHuTable.FullSave(client);
                        
Database.EntityTable.SaveEntity(client);
                        
Database.SkillTable.SaveClientSpells(client);
                        
Database.SkillTable.SaveProficiencies(client);
                        
Database.ArenaTable.SaveArenaStatistics(client.ArenaStatistic);
                        
Database.TeamArenaTable.SaveArenaStatistics(client.TeamArenaStatistic);
                    }
                }
                
Database.InnerPowerTable.Save();
                
Database.Flowers.SaveFlowers();
                
AuctionBase.Save();
                
Game.ClanWarArena.Save();
                
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("configuration").Where("Server"Constants.ServerName))
                {
                    
NobilityOff.Save(clientconn);
                    
using (MySqlReader r = new MySqlReader(cmd))
                    {
                        if (
r.Read())
                        {
                            new 
Database.MySqlCommand(Database.MySqlCommandType.Update).Update("configuration").Set("EntityID"EntityUID.Now).Set("ServerKingdom"Kernel.ServerKingdom).Set("GuildID"Game.ConquerStructures.Society.Guild.GuildCounter.Now).Where("Server"Constants.ServerName).Execute();
                            if (
r.ReadByte("LastDailySignReset") != DateTime.Now.MonthMsgSignIn.Reset();
                        }
                    }
                }
                
using (var cmd = new MySqlCommand(MySqlCommandType.Update).Update("configuration"))
                    
cmd.Set("LastDailySignReset"DateTime.Now.Month).Execute();
               
Console.WriteLine("Saving Data Done By Rayzo.");
                if (Exit)
                    
Environment.Exit(0);
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
                return 
false;
            }
            return 
true;
        }
        
#region Exceptions & Logs
        
public static void AddVendorLog(String vendorstring buyingstring moneyamountConquerItem Item)
        {
            
String folderN DateTime.Now.Year "-" DateTime.Now.Month,
                
Path "gmlogs\\VendorLogs\\",
                
NewPath System.IO.Path.Combine(PathfolderN);
            if (!
File.Exists(NewPath folderN))
            {
                
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathfolderN));
            }
            if (!
File.Exists(NewPath "\\" DateTime.Now.Day ".txt"))
            {
                
using (System.IO.FileStream fs System.IO.File.Create(NewPath "\\" DateTime.Now.Day ".txt"))
                {
                    
fs.Close();
                }
            }

            
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath "\\" DateTime.Now.Day ".txt"true))
            {
                
file.WriteLine("------------------------------------------------------------------------------------");
                
file.WriteLine("{0} HAS BOUGHT AN ITEM : {2} FROM {1} SHOP - for {3}"vendorbuyingItem.ToLog(), moneyamount);
                
file.WriteLine("------------------------------------------------------------------------------------");
                
file.Close();
            }
        }
        public static 
void AddGMCommand(string gmstring commandStr)
        {
            
String folderN DateTime.Now.Year "-" DateTime.Now.Month,
                
Path "gmlogs\\GMCommandsLog\\",
                
NewPath System.IO.Path.Combine(PathfolderN);
            if (!
File.Exists(NewPath folderN))
            {
                
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathfolderN));
            }
            if (!
File.Exists(NewPath "\\" DateTime.Now.Day ".txt"))
            {
                
using (System.IO.FileStream fs System.IO.File.Create(NewPath "\\" DateTime.Now.Day ".txt"))
                {
                    
fs.Close();
                }
            }

            
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath "\\" DateTime.Now.Day ".txt"true))
            {
                
file.WriteLine(gm commandStr);
                
file.Close();
            }
        }
        public static 
void RemoveCps(string text)
        {
            try
            {
                
text "[" DateTime.Now.ToString("HH:mm:ss") + "]" text;
                
String folderN DateTime.Now.Year "-" DateTime.Now.Month,
                        
Path "gmlogs\\RemoveCps\\",
                        
NewPath System.IO.Path.Combine(PathfolderN);
                if (!
File.Exists(NewPath folderN))
                {
                    
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathfolderN));
                }
                if (!
File.Exists(NewPath "\\" DateTime.Now.Day ".txt"))
                {
                    
using (System.IO.FileStream fs System.IO.File.Create(NewPath "\\" DateTime.Now.Day ".txt"))
                    {
                        
System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath "\\" DateTime.Now.Day ".txt"true);
                        
fs.Close();
                    }
                }
                
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath "\\" DateTime.Now.Day ".txt"true))
                {
                    
file.WriteLine(text);
                    
file.Close();
                }
            }
            catch (
Exception ex) { Console.WriteLine(ex); }
        }
        public static 
void AddCpsWin(string text)
        {
            try
            {
                
text "[" DateTime.Now.ToString("HH:mm:ss") + "]" text;
                
String folderN DateTime.Now.Year "-" DateTime.Now.Month,
                        
Path "gmlogs\\AddWinCps\\",
                        
NewPath System.IO.Path.Combine(PathfolderN);
                if (!
File.Exists(NewPath folderN))
                {
                    
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathfolderN));
                }
                if (!
File.Exists(NewPath "\\" DateTime.Now.Day ".txt"))
                {
                    
using (System.IO.FileStream fs System.IO.File.Create(NewPath "\\" DateTime.Now.Day ".txt"))
                    {
                        
fs.Close();
                    }
                }
                
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath "\\" DateTime.Now.Day ".txt"true))
                {
                    
file.WriteLine(text);
                    
file.Close();
                }

            }
            catch (
Exception ex) { Console.WriteLine(ex); }
        }
        public static 
void AddDropLog(String NameConquerItem Item)
        {
            
String folderN DateTime.Now.Year "-" DateTime.Now.Month,
                
Path "gmlogs\\droplogs\\",
                
NewPath System.IO.Path.Combine(PathfolderN);
            if (!
File.Exists(NewPath folderN))
            {
                
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathfolderN));
            }
            
string path NewPath "\\" DateTime.Now.Day ".txt";
            if (!
File.Exists(path)) File.AppendAllText(path"");

            
string text "------------------------------------------------------------------------------------"
                
Environment.NewLine string.Format("Entity {0} HAS DROPPED AN ITEM : {1} -"NameItem.ToLog())
                + 
Environment.NewLine "------------------------------------------------------------------------------------";
            
File.AppendAllText(pathtext);
        }
        public static 
void AddTradeLog(Game.ConquerStructures.Trade firstString firstNGame.ConquerStructures.Trade secondString secondN)
        {
            
String folderN DateTime.Now.Year "-" DateTime.Now.Month,
                
Path "database\\Security\\Trade\\",
                
NewPath System.IO.Path.Combine(PathfolderN);
            if (!
File.Exists(NewPath folderN))
            {
                
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathfolderN));
            }
            if (!
File.Exists(NewPath "\\" DateTime.Now.Day ".txt"))
            {
                
using (System.IO.FileStream fs System.IO.File.Create(NewPath "\\" DateTime.Now.Day ".txt"))
                {
                    
fs.Close();
                }
            }

            
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath "\\" DateTime.Now.Day ".txt"true))
            {
                
file.WriteLine("************************************************************************************");
                
file.WriteLine("First Person TradeLog ({0}) -"firstN);
                
file.WriteLine("Gold Traded: " first.Money);
                
file.WriteLine("Conquer Points Traded: " first.ConquerPoints);

                for (
int i 0first.Items.Counti++)
                {
                    
file.WriteLine("------------------------------------------------------------------------------------");
                    
file.WriteLine("Item : " first.Items[i].ToLog());
                    
file.WriteLine("------------------------------------------------------------------------------------");
                }
                
file.WriteLine("Second Person TradeLog ({0}) -"secondN);
                
file.WriteLine("Gold Traded: " second.Money);
                
file.WriteLine("Conquer Points Traded: " second.ConquerPoints);

                for (
int i 0second.Items.Counti++)
                {
                    
file.WriteLine("------------------------------------------------------------------------------------");
                    
file.WriteLine("Item : " second.Items[i].ToLog());
                    
file.WriteLine("------------------------------------------------------------------------------------");
                }
                
file.WriteLine("************************************************************************************");
            }
        }
        public static 
void AddMobLog(string Warstring nameuint CPs 0uint item 0)
        {
            
String folderN DateTime.Now.Year "-" DateTime.Now.Month,
                    
Path "gmlogs\\MobLogs\\",
                    
NewPath System.IO.Path.Combine(PathfolderN);
            if (!
File.Exists(NewPath folderN))
            {
                
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathfolderN));
            }
            if (!
File.Exists(NewPath "\\" DateTime.Now.Day ".txt"))
            {
                
using (System.IO.FileStream fs System.IO.File.Create(NewPath "\\" DateTime.Now.Day ".txt"))
                {
                    
fs.Close();
                }
            }

            
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath "\\" DateTime.Now.Day ".txt"true))
            {
                if (
CPs != 0)
                    
file.WriteLine(name " got " CPs " CPs from the [" War "] as prize at " DateTime.Now.Hour ":" DateTime.Now.Minute ":" DateTime.Now.Second);
                else
                    
file.WriteLine(name " got " item " Item from the [" War "] as prize at " DateTime.Now.Hour ":" DateTime.Now.Minute ":" DateTime.Now.Second);
            }
        }
        public static 
void AddWarLog(string Warstring CPsstring name)
        {
            
String folderN DateTime.Now.Year "-" DateTime.Now.Month,
                    
Path "gmlogs\\Warlogs\\",
                    
NewPath System.IO.Path.Combine(PathfolderN);
            if (!
File.Exists(NewPath folderN))
            {
                
System.IO.Directory.CreateDirectory(System.IO.Path.Combine(PathfolderN));
            }
            if (!
File.Exists(NewPath "\\" DateTime.Now.Day ".txt"))
            {
                
using (System.IO.FileStream fs System.IO.File.Create(NewPath "\\" DateTime.Now.Day ".txt"))
                {
                    
fs.Close();
                }
            }

            
using (System.IO.StreamWriter file = new System.IO.StreamWriter(NewPath "\\" DateTime.Now.Day ".txt"true))
            {
                
file.WriteLine(name " got " CPs " CPs from the [" War "] as prize at " DateTime.Now.Hour ":" DateTime.Now.Minute ":" DateTime.Now.Second);
            }
        }
        static 
void Application_ThreadException(object senderUnhandledExceptionEventArgs e)
        {
            
SaveException(e.ExceptionObject as Exception);
        }
        public static 
void SaveException(Exception e)
        {
            
Console.WriteLine(e);

            var 
dt DateTime.Now;
            
string date dt.Month "-" dt.Day "//";

            if (!
Directory.Exists(Application.StartupPath Constants.UnhandledExceptionsPath))
                
Directory.CreateDirectory(Application.StartupPath "\\" Constants.UnhandledExceptionsPath);
            if (!
Directory.Exists(Application.StartupPath "\\" Constants.UnhandledExceptionsPath date))
                
Directory.CreateDirectory(Application.StartupPath "\\" Constants.UnhandledExceptionsPath date);
            if (!
Directory.Exists(Application.StartupPath "\\" Constants.UnhandledExceptionsPath date e.TargetSite.Name))
                
Directory.CreateDirectory(Application.StartupPath "\\" Constants.UnhandledExceptionsPath date e.TargetSite.Name);

            
string fullPath Application.StartupPath "\\" Constants.UnhandledExceptionsPath date e.TargetSite.Name "\\";

            
string date2 dt.Hour "-" dt.Minute;
            List<
stringLines = new List<string>();

            
Lines.Add("----Exception message----");
            
Lines.Add(e.Message);
            
Lines.Add("----End of exception message----\r\n");

            
Lines.Add("----Stack trace----");
            
Lines.Add(e.StackTrace);
            
Lines.Add("----End of stack trace----\r\n");

            
//Lines.Add("----Data from exception----");
            //foreach (KeyValuePair<object, object> data in e.Data)
            //    Lines.Add(data.Key.ToString() + "->" + data.Value.ToString());
            //Lines.Add("----End of data from exception----\r\n");

            
File.WriteAllLines(fullPath date2 ".txt"Lines.ToArray());
        }
        
#endregion
        
private static void WorkConsole()
        {
            while (
true)
            {
                try
                {
                    
CommandsAI(Console.ReadLine());
                    
                }
                catch (
Exception e) { Console.WriteLine(e); }
            }
        }
        public static 
DateTime LastRandomReset DateTime.Now;
        public static 
Network.GamePackets.BlackSpotPacket BlackSpotPacket = new Network.GamePackets.BlackSpotPacket();
        public static 
bool MyPC true;
        public static 
void CommandsAI(string command)
        {
            try
            {
                if (
command == null)
                    return;
                
string[] data command.Split(' ');
                switch (
data[0])
                {
                    case 
"@clear":
                        {
                            
                            
Console.Clear();
                            
Rayzo.Console.WriteLine("Consle and program Cleared ");
                            break;
                        }
                  
                    case 
"@sh":
                        {
                            
Console.WriteLine(Program.SnowBa);
                            break;
                        }
                    case 
"@sh1":
                        {
                            
Program.SnowBa true;
                            break;
                        }
                    case 
"@sh2":
                        {
                            
Program.SnowBa false;
                            break;
                        }
                    case 
"@Copra":
                    case 
"@bigbos":
                        
Rayzo.Console.WriteLine("Server will restart after 10 minutes.");
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 5 minute, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 4 minute 30 second, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 4 minute, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 3 minute 30 second, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 3 minute, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 2 minute 30 second, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 2 minute, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 1 minute 30 second, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 1 minute, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The server will be brought down for maintenance in 30 second, Please exit the game now."System.Drawing.Color.Orange0x7db), Program.Values);
                        
Rayzo.Console.WriteLine("Server will exit after 1 minute.");
                        
CommandsAI("@save");
                        
System.Threading.Thread.Sleep(0x7530);
                        
Kernel.SendWorldMessage(new Rayzo.Network.GamePackets.Message("The Server restarted, Please log in after 5 minutes  "System.Drawing.Color.Orange0x7db), Program.Values);
                        try
                        {
                            
CommandsAI("@restart");
                        }
                        catch
                        {
                            
Rayzo.Console.WriteLine("Server cannot exit");
                        }
                        break;
                    case 
"@flushbans":

                        {
                            
Database.IPBan.Load();
                            break;
                        }
                    case 
"@alivetime":
                        {
                            
DateTime now DateTime.Now;
                            
TimeSpan t2 = new TimeSpan(StartDate.ToBinary());
                            
TimeSpan t1 = new TimeSpan(now.ToBinary());
                            
Console.WriteLine("The server has been online " + (int)(t1.TotalHours t2.TotalHours) + " hours, " + (int)((t1.TotalMinutes t2.TotalMinutes) % 1) + " minutes.");
                            break;
                        }
                    case 
"@online":
                        {
                            
Console.WriteLine("Online Entitys count: " Kernel.GamePool.Count);
                            
string line "";
                            foreach (
Client.GameState pClient in Program.Values)
                                
line += pClient.Entity.Name ",";
                            if (
line != "")
                            {
                                
line line.Remove(line.Length 1);
                                
Console.WriteLine("Entitys: " line);
                            }
                            break;
                        }
                    case 
"@memoryusage":
                        {
                            var 
proc System.Diagnostics.Process.GetCurrentProcess();
                            
Console.WriteLine("Thread count: " proc.Threads.Count);
                            
Console.WriteLine("Memory set(MB): " + ((double)((double)proc.WorkingSet64 1024)) / 1024);
                            
proc.Close();
                            break;
                        }
                    case 
"@save":
                        {
                            
Save();
                        }
                        break;
                    case 
"@PlayerCap":
                        {
                            try
                            {
                                
PlayerCap int.Parse(data[1]);
                            }
                            catch
                            {

                            }
                            break;
                        }
                    case 
"@skill":
                        {
                            
Game.Features.Tournaments.SkillPk.SkillTournament.Open();
                            foreach (var 
clien in Kernel.GamePool.Values)
                            {
                                if (
clien.Team == null)
                                    
clien.Team = new Game.ConquerStructures.Team(clien);
                                
Game.Features.Tournaments.SkillPk.SkillTournament.Join(clien3);
                            }
                            break;
                        }
                    case 
"@team":
                        {
                            
Game.Features.Tournaments.TeamPk.TeamTournament.Open();
                            foreach (var 
clien in Kernel.GamePool.Values)
                            {
                                if (
clien.Team == null)
                                    
clien.Team = new Game.ConquerStructures.Team(clien);
                                
Game.Features.Tournaments.TeamPk.TeamTournament.Join(clien3);
                            }
                            break;
                        }
                    case 
"@exit":
                        {
                            
CommandsAI("@save");
                            
                           
                            new 
Database.MySqlCommand(Database.MySqlCommandType.Update).Update("configuration").Set("ItemUID"ConquerItem.ItemUID.Now).Where("Server"Constants.ServerName).Execute();
                            
Database.EntityVariableTable.Save(0Vars);

                            var 
WC Program.Values.ToArray();
                            
Parallel.ForEach(Program.Valuesclient =>
                            {
                                
client.Send(" Server will exit for 5 min to Solve The Problem, please be paitent ");
                                
client.Disconnect();
                            });

                            
Kernel.SendWorldMessage(new Network.GamePackets.Message(string.Concat(new object[] { " Server will exit for 5 min to Solve The Problem, please be paitent " }), System.Drawing.Color.Black0x7db), Program.Values);


                            if (
GuildWar.IsWar)
                                
GuildWar.End();
                            new 
Database.MySqlCommand(Database.MySqlCommandType.Update).Update("configuration").Set("ItemUID"ConquerItem.ItemUID.Now).Where("Server"Constants.ServerName).Execute();
                            
Environment.Exit(0);
                        }
                        break;
                    case 
"serverpass":
                        {
                            
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT))
                            {
                                
cmd.Select("configuration").Where("Server"Constants.ServerName);
                                
using (MySqlReader r = new MySqlReader(cmd))
                                {
                                    if (
r.Read())
                                        
Constants.ServerGMPass r.ReadString("ServerGMPass");
                                }

                            }
                            break;
                        }
                    case 
"@pressure":
                        {
                            
Console.WriteLine("Genr: " World.GenericThreadPool.ToString());
                            
Console.WriteLine("Send: " World.SendPool.ToString());
                            
Console.WriteLine("Recv: " World.ReceivePool.ToString());
                            break;
                        }
                    case 
"@restart":
                        {
                            try
                            {
                                
Kernel.SendWorldMessage(new Network.GamePackets.Message(string.Concat(new object[] { "Server Will Be Restart Now !" }), System.Drawing.Color.Black0x7db), Program.Values);
                                
CommandsAI("@save");
                                new 
Database.MySqlCommand(Database.MySqlCommandType.Update).Update("configuration").Set("ItemUID"ConquerItem.ItemUID.Now).Where("Server"Constants.ServerName).Execute();
                                var 
WC Program.Values.ToArray();
                                foreach (
Client.GameState client in WC)
                                {
                                    
client.Send(" Server Will Be Restart Now ");
                                    
client.Disconnect();
                                }
                                
                               
                                if (
GuildWar.IsWar)
                                    
GuildWar.End();
                                new 
Database.MySqlCommand(Database.MySqlCommandType.Update).Update("configuration").Set("ItemUID"ConquerItem.ItemUID.Now).Where("Server"Constants.ServerName).Execute();
                                
Application.Restart();
                                
Environment.Exit(0);
                            }
                            catch (
Exception e)
                            {
                                
Console.WriteLine(e);
                                
Console.ReadLine();
                            }
                        }
                        break;
                    case 
"@account":
                        {
                            
Database.AccountTable account = new AccountTable(data[1]);
                            
account.Password data[2];
                            
account.State AccountTable.AccountState.Entity;
                            
account.Save();
                        }
                        break;
                    case 
"@process":
                        {
                            
HandleClipboardPacket(command);
                            break;
                        }
                }
            }
            catch (
Exception e)
            {
                
Console.WriteLine(e.ToString());
            }
        }
        public static 
void WriteLine(string Line)
        {
            try
            {
                
Console.WriteLine(Line);
            }
            catch { }
        }
        public static 
void HandleClipboardPacket(string cmd)
        {
            
string[] pData cmd.Split(' ');
            
long off 0type 0val 0;
            if (
pData.Length 1)
            {
                
string[] oData pData[1].Split(':');
                if (
oData.Length == 3)
                {
                    
off long.Parse(oData[0]);
                    
type long.Parse(oData[1]);
                    if (
oData[2] == "u")
                        
val 1337;
                    else
                        
val long.Parse(oData[2]);
                }
            }
            
string Data OSClipboard.GetText();
            
string[] num Data.Split(new[] { " " }, StringSplitOptions.RemoveEmptyEntries);
            
byte[] packet = new byte[num.Length 8];
            for (
int i 0num.Lengthi++)
                
packet[i] = byte.Parse(num[i], System.Globalization.NumberStyles.HexNumber);
            
Writer.WriteUInt16((ushort)(packet.Length 8), 0packet);
            if (
off != 0)
            {
                switch (
type)
                {
                    case 
1:
                        {
                            
packet[(int)off] = (byte)val;
                            break;
                        }
                    case 
2:
                        {
                            
Writer.WriteUInt16((ushort)val, (int)offpacket);
                            break;
                        }
                    case 
4:
                        {
                            
Writer.WriteUInt32((uint)val, (int)offpacket);
                            break;
                        }
                    case 
8:
                        {
                            
Writer.WriteUInt64((ulong)val, (int)offpacket);
                            break;
                        }
                }
            }
            foreach (var 
client in Program.Values)
            {
                if (
val == 1337 && type == 4)
                    
Writer.WriteUInt32(client.Entity.UID, (int)offpacket);
                
client.Send(packet);
            }
        }
        
#region GameServer|AuthServer
        
private static void GameServer_OnClientReceive(byte[] bufferint lengthClientWrapper obj)
        {
            if (
obj.Owner == null)
            {
                
obj.Disconnect();
            }
            else
            {
                
GameState connector obj.Owner as GameState;
                if (
connector.Exchange)
                {
                    
connector.Exchange false;
                    
connector.Action = (byte)1;
                    
Rayzo.Network.Cryptography.GameCryptography gameCryptography = new Rayzo.Network.Cryptography.GameCryptography(Encoding.Default.GetBytes(Constants.GameCryptographyKey));
                    
byte[] numArray = new byte[length];
                    Array.
Copy((Array)buffer, (Array)numArraylength);
                    
gameCryptography.Decrypt(numArraylength);
                    
bool flag false;
                    
int offset 0;
                    for (
int x 080x++)
                    {
                        if (
BitConverter.ToInt32(numArrayx) == 128)
                        {
                            if (
length >= 205)
                            {
                                
offset x;
                                
flag true;
                                
connector.Cryptography.Decrypt(bufferlength 40);
                            }
                            else
                            {
                                
offset x;
                                
connector.Cryptography.Decrypt(bufferlength);
                            }
                        }
                    }
                    
int int32 BitConverter.ToInt32(bufferoffset);
                    
int index1 offset 4;
                    if (
int32 != 128)
                    {
                        
connector.Disconnect(true);
                    }
                    else
                    {
                        
byte[] bytes = new byte[128];
                        
int index2 0;
                        while (
index2 int32)
                        {
                            
bytes[index2] = buffer[index1];
                            ++
index2;
                            ++
index1;
                        }
                        
string PublicKey Encoding.Default.GetString(bytes);
                        
connector.Cryptography connector.DHKeyExchange.HandleClientKeyPacket(PublicKeyconnector.Cryptography);
                        if (!
flag)
                            return;
                        
byte[] buffer1 = new byte[40];
                        
Buffer.BlockCopy((Array)bufferlength 40, (Array)buffer1040);
                        
processData(buffer140connector);
                    }
                }
                else
                    
processData(bufferlengthconnector);
            }
        }
        
//private static void GameServer_OnClientReceive(byte[] buffer, int length, ClientWrapper obj)
        //{
        //    if (obj.Connector == null)
        //    {
        //        obj.Disconnect();
        //    }
        //    else
        //    {
        //        GameState connector = obj.Connector as GameState;
        //        if (connector.Exchange)
        //        {
        //            connector.Exchange = false;
        //            connector.Action = (byte)1;
        //            Network.Cryptography.GameCryptography gameCryptography = new Network.Cryptography.GameCryptography(Encoding.Default.GetBytes(Constants.GameCryptographyKey));
        //            byte[] numArray = new byte[length];
        //            Array.Copy((Array)buffer, (Array)numArray, length);
        //            gameCryptography.Decrypt(numArray, length);
        //            bool flag = false;
        //            int offset = 0;
        //            for (int x = 0; x < 80; x++)
        //            {
        //                if (BitConverter.ToInt32(numArray, x) == 128)
        //                {
        //                    if (length >= 205)
        //                    {
        //                        offset = x;
        //                        flag = true;
        //                        connector.Cryptography.Decrypt(buffer, length - 40);
        //                    }
        //                    else
        //                    {
        //                        offset = x;
        //                        connector.Cryptography.Decrypt(buffer, length);
        //                    }
        //                }
        //            }
        //            int int32 = BitConverter.ToInt32(buffer, offset);
        //            int index1 = offset + 4;
        //            if (int32 != 128)
        //            {
        //                connector.Disconnect(true);
        //            }
        //            else
        //            {
        //                byte[] bytes = new byte[128];
        //                int index2 = 0;
        //                while (index2 < int32)
        //                {
        //                    bytes[index2] = buffer[index1];
        //                    ++index2;
        //                    ++index1;
        //                }
        //                string PublicKey = Encoding.Default.GetString(bytes);
        //                connector.Cryptography = connector.DHKeyExchange.HandleClientKeyPacket(PublicKey, connector.Cryptography);
        //                if (!flag)
        //                    return;
        //                byte[] buffer1 = new byte[40];
        //                Buffer.BlockCopy((Array)buffer, length - 40, (Array)buffer1, 0, 40);
        //                processData(buffer1, 40, connector);
        //            }
        //        }
        //        else
        //            processData(buffer, length, connector);
        //    }
        //}
        
private static void processData(byte[] bufferint lengthClient.GameState Client)
        {
            
Client.Cryptography.Decrypt(bufferlength);
            
Client.Queue.Enqueue(bufferlength);
            if (
Client.Queue.CurrentLength 1224)
            {
                
Console.WriteLine("[Disconnect]Reason:The packet size is too big. " Client.Queue.CurrentLength);
                
Client.Disconnect();
                return;
            }
            while (
Client.Queue.CanDequeue())
            {
                
byte[] data Client.Queue.Dequeue();
                
Network.PacketHandler.HandlePacket(dataClient);
            }
        }
        static 
void GameServer_OnClientConnect(ClientWrapper obj)
        {
            
Client.GameState client = new Client.GameState(obj);
            
client.Send(client.DHKeyExchange.CreateServerKeyPacket());
            
obj.Owner client;
        }
        static 
void GameServer_OnClientDisconnect(ClientWrapper obj)
        {
            if (
obj.Owner != null)
                (
obj.Owner as Client.GameState).Disconnect();
            else
                
obj.Disconnect();
        }
        public static 
void AuthServer_OnClientReceive(byte[] bufferint lengthClientWrapper arg3)
        {
            var 
player arg3.Owner as Client.AuthClient;
            
AuthClient authClient arg3.Owner as AuthClient;
            
player.Cryptographer.Decrypt(bufferlength);
            
player.Queue.Enqueue(bufferlength);
            while (
player.Queue.CanDequeue())
            {
                
byte[] packet player.Queue.Dequeue();
                
ushort len BitConverter.ToUInt16(packet0);
                if (
len == 312)
                {
                    
player.Info = new Authentication();
                    
player.Info.Deserialize(packet);
                    
player.Account = new AccountTable(player.Info.Username);
                    if (!
LoginBruteForce.AcceptJoin(arg3.IP))
                    {
                        
Console.WriteLine(string.Concat(new string[] { "Client > "player.Info.Username"was blocked address"arg3.IP"!" }));
                        
arg3.Disconnect();
                        break;
                    }
                    
Forward Fw = new Forward();
                   
// System.Console.WriteLine("UserName: {0} Password: {1} ServerName: {2} Online", player.Info.Username, player.Info.Password, player.Info.Server);
                    
if (player.Account.Username == player.Info.Username && player.Account.exists)
                    {
                        if (
player.Account.Password == player.Info.Password && player.Account.exists)
                        {
                            
Fw.Identifier player.Account.GenerateKey();
                            
Kernel.AwaitingPool[Fw.Identifier] = player.Account;
                            
Fw.IP GameIP;
                            
Fw.Port GamePort;
                        }
                        else
                        {
                            
LoginBruteForce.ClientRegistred(arg3.IP);
                            
Fw.Type Forward.ForwardType.InvalidInfo;
                        }
                    }
                    else
                    {
                        
Fw.Type Forward.ForwardType.WrongAccount;
                    }
                    
player.Send(Fw);
                }
            }
        }
        
//public static void AuthServer_OnClientReceive(byte[] buffer, int length, ClientWrapper arg3)
        //{
        //    var player = arg3.Connector as Client.AuthClient;
        //    AuthClient authClient = arg3.Connector as AuthClient;
        //    player.Cryptographer.Decrypt(buffer, length);
        //    player.Queue.Enqueue(buffer, length);
        //    while (player.Queue.CanDequeue())
        //    {
        //        byte[] packet = player.Queue.Dequeue();
        //        ushort len = BitConverter.ToUInt16(packet, 0);
        //        if (len == 312)
        //        {
        //            player.Info = new ServerProject.Network.AuthPackets.Authentications();
        //            player.Info.Deserialize(packet);
        //            player.Account = new AccountTable(player.Info.Username);
        //            if (!LoginBruteForce.AcceptJoin(arg3.IP))
        //            {
        //                Console.WriteLine(string.Concat(new string[] { "Client > ", player.Info.Username, "was blocked address", arg3.IP, "!" }));
        //                arg3.Disconnect();
        //                break;
        //            }
        //            Forward Fw = new Forward();
        //            //Console.WriteLine("UserName: {0} Password: {1} ServerName: {2} Online", player.Info.Username, player.Info.Password, player.Info.Server);
        //            if (player.Account.Username == player.Info.Username && player.Account.exists)
        //            {
        //                if (player.Account.Password == player.Info.Password && player.Account.exists)
        //                {
        //                    Fw.Identifier = player.Account.GenerateKey();
        //                    Kernel.AwaitingPool[Fw.Identifier] = player.Account;
        //                    Fw.IP = GameIP;
        //                    Fw.Port = GamePort;
        //                }
        //                else
        //                {
        //                    LoginBruteForce.ClientRegistred(arg3.IP);
        //                    Fw.Type = Forward.ForwardType.InvalidInfo;
        //                }
        //            }
        //            else
        //            {
        //                Fw.Type = Forward.ForwardType.WrongAccount;
        //            }
        //            player.Send(Fw);
        //        }
        //    }
        //}


        
static void AuthServer_OnClientDisconnect(ClientWrapper obj)
        {
            
obj.Disconnect();
        }
        static 
void AuthServer_OnClientConnect(ClientWrapper obj)
        {
            
Client.AuthClient authState;
            
obj.Owner = (authState = new Client.AuthClient(obj));
            
authState.Cryptographer = new Network.Cryptography.AuthCryptography();
            
Network.AuthPackets.PasswordCryptographySeed pcs = new PasswordCryptographySeed();
            
pcs.Seed Kernel.Random.Next();
            
authState.PasswordSeed pcs.Seed;
            
authState.Send(pcs);
            
// Protection.LoaderProgram.CLientsPass.Clear();////////
            //Protection.LoaderProgram.CLientsPass.Add(authState.PasswordSeed, "");
        
}
        
internal static Client.GameState FindClient(string name)
        {
            return 
GamePool.FirstOrDefault(=> p.Entity.LoweredName == name);
        }
        
#endregion
        #region Copra Style
        
static bool thistime false;
        private static 
void CopraStep(int widthint heightint[] yint[] l)
        {
            
int x;
            
thistime = !thistime;
            for (
0width; ++x)
            {
                if (
11 == 10)
                {
                    if (!
thistime)
                        continue;
                    
System.Console.ForegroundColor System.ConsoleColor.Red;
                }
                else
                {
                    
System.Console.ForegroundColor System.ConsoleColor.DarkGreen;
                    
System.Console.SetCursorPosition(xinBoxY(y[x] - - (l[x] / 40 2), height));
                    
System.Console.Write(R);
                    
System.Console.ForegroundColor System.ConsoleColor.Green;
                }
                
System.Console.SetCursorPosition(xy[x]);
                
System.Console.Write(R);
                
y[x] = inBoxY(y[x] + 1height);
                
System.Console.SetCursorPosition(xinBoxY(y[x] - l[x], height));
                
System.Console.Write(' ');
            }
        }
        private static 
void Initialize(out int widthout int heightout int[] yout int[] l)
        {
            
int h1;
            
int h2 = (h1 = (height System.Console.WindowHeight) / 2) / 2;
            
width System.Console.WindowWidth 1;
            
= new int[width];
            
= new int[width];
            
int x;
            
System.Console.Clear();
            for (
0width; ++x)
            {
                
y[x] = r.Next(height);
                
l[x] = r.Next(h2 * ((11 != 10) ? 1), h1 * ((11 != 10) ? 1));
            }
        }
        static 
Random r = new Random();
        public static 
DateTime KingsTime;

        static 
char R
        
{
            
get
            
{
                
int t r.Next(10);
                if (
<= 2)
                    return (
char)('0' r.Next(10));
                else if (
<= 4)
                    return (
char)('a' r.Next(27));
                else if (
<= 6)
                    return (
char)('A' r.Next(27));
                else
                    return (
char)(r.Next(32255));
            }
        }
        public static 
int inBoxY(int nint height)
        {
            
height;
            if (
0)
                return 
height;
            else
                return 
n;
        }
        
#endregion Copra Style
        
internal static void WriteLine(string pushort MsgIdshort p_2)
        {
            throw new 
NotImplementedException();
        }
        public static 
int Carnaval getset; }
        public static 
int Carnaval2 getset; }
        public static 
int Carnaval3 getset; }
        public static 
uint NextItemID getset; }

        public static 
uint ExpRateSpell 2;

        public static 
string GetString(byte[] dataint positionint count)
        {
            var 
str Program.Encoding.GetString(datapositioncount);
            
str str.Replace("\0""").Replace("\r""");
            return 
str;
        }
        public static 
string GetString(byte[] data)
        {
            var 
str Program.Encoding.GetString(data);
            
str str.Replace("\0""").Replace("\r""");
            return 
str;
        }
        public static List<
ushortEventsMap = new List<ushort>()
        {
            
50001500025000350004500055000650007500085000950010500115001250013500145001550016500171508151820141507,
        };
        public static 
string NameGame;
        private static 
unsafe GameState client;
        private static 
MySql.Data.MySqlClient.MySqlConnection conn;

       
// public static bool Nobility { get; set; }
    
}
    public class 
Copra_Times
    
{
        public static 
DateTime now
        
{
            
get
            
{
                return 
DateTime.Now;
            }
        }
        public class 
Start
        
{
            public static 
bool SnowBanshee
            
{
                
get
                
{
                    return (
now.Minute == 57 && now.Second == 1);
                }
            }
            public static 
bool SwordMaster
            
{
                
get
                
{
                    return (
now.Minute == && now.Second == 1);
                }
            }
            public static 
bool TeratoDragon
            
{
                
get
                
{
                    return (
now.Minute == 10 && now.Second == 1);
                }
            }
            public static 
bool ThrillingSpook
            
{
                
get
                
{
                    return (
now.Minute == 30 && now.Second == 1);
                }
            }
            public static 
bool NemesisTyrant
            
{
                
get
                
{
                    return (
now.Minute == 45 && now.Second == 1);
                }
            }
            public static 
bool SkyWar
            
{
                
get
                
{
                    return (
now.Hour == || now.Hour == 13) && now.Minute == 10 && now.Second == 1;
                }
            }
            public static 
bool TheTeam
            
{
                
get
                
{
                    return (
now.Hour == 14 || now.Hour == 2) && now.Minute == 10 && now.Second == 1;
                }
            }
            public static 
bool EliteGW
            
{
                
get
                
{
                    return (
now.Minute == 30);
                }
            }
            public static 
bool SkillTeam
            
{
                
get
                
{
                    return (
now.Hour == 11) && now.Minute == 00;
                }
            }
            public static 
bool TeamPK
            
{
                
get
                
{
                    return (
now.Hour == 16) && now.Minute == 00;
                }
            }
            public static 
bool NobiltyWarPole
            
{
                
get
                
{
                    return (
now.Hour == 22 && now.Minute == 00) || (now.Hour == && now.Minute == 0);
                }
            }
            public static 
bool GuildScoreWar
            
{
                
get
                
{
                    return (
now.Hour == 14 && now.Minute == 0) || (now.Hour == 23 && now.Minute == 0);
                }
            }
            public static 
bool ClassWar
            
{
                
get
                
{
                    return (
now.Hour == 18 && now.Minute == 0) || (now.Hour == && now.Minute == 0);
                }
            }
            public static 
bool HeroOfGame
            
{
                
get
                
{
                    return 
now.Minute == 30;
                }
            }
            public static 
bool FBSS
            
{
                
get
                
{
                    return 
now.Minute == 25;
                }
            }
            public static 
bool FBSS2
            
{
                
get
                
{
                    return 
now.Minute >= 25 && now.Minute 28;
                }
            }
            public static 
int hunterthief 42;
            public static 
int dashbash 46;
            public static 
int chase 45;
            public static 
int dizzy 49;
            public static 
bool Nobilty
            
{
                
get
                
{
                    return 
now.Minute >= 20 && now.Minute <= 24;
                }
            }

           
// public static bool TeratoDragon { get; set; }
        
}
        public class 
End
        
{
            public static 
bool FBSS
            
{
                
get
                
{
                    return 
now.Minute >= 28;
                }
            }
            public static 
int hunterthief 45;
            public static 
int dashbash 48;
            public static 
bool Cyclone
            
{
                
get
                
{
                    return 
now.Minute == 29;
                }
            }
            public static 
int chase 45;
            public static 
int dizzy2 50;
            public static 
bool Nobilty
            
{
                
get
                
{
                    return 
now.Minute >= 25;
                }
            }
            public static 
bool EliteGW
            
{
                
get
                
{
                    return 
now.Minute >= 45;
                }
            }
        }
    }
    public class 
rates
    
{
        
/// <summary>  
        /// Player//Attack   
        /// </summary>  
        
public static double SuperTwoFold;
        public static 
double TwilightDance;//label17//trackBar9  
        
public static double OshaFoldBlade;//label21//trackBar10  
        
public static double Phoenix;//label22//trackBar11  
        
public static double ChargingVortex;
        public static 
double BlisteringWave;
        public static 
double BladeTempest;
        public static 
double DragonSlash;
        public static 
double CrackingSwipe;//Yes  
        
public static double SplittingSwipe;//Yes  
        
public static double AirKick;//Yes  
        
public static double AirSweep;//Yes  
        
public static double AirRaid;//Yes  
        
public static double DragonCyclone;//Yes  
        
public static double SpeedKick;//Yes  
        
public static double ViolentKick;//Yes  
        
public static double StormKick;//YesYes  
        
public static double DragonFury;//Yes  
        
public static double DragonPunch;
        public static 
double ScentSword;
        public static 
double FastBlade;//label24//trackBar12  
        
public static double Hercules;//label34//trackBar13  
        
public static double TigerMonk;
        
/// <summary>  
        /// SobNpc//Attack  
        /// </summary>  
        
public static double TwoFoldBlad;
        public static 
double MortalWound;
        public static 
double DaggerStorm;
        public static 
double OshaPashaa;
        public static 
double EagleEye;
        public static 
double FatalCross;
        public static 
double KickMonk;  
        public static 
uint GuildWar;
        public static 
uint ChangeName;
        public static 
uint king;
        public static 
uint prince;
        public static 
uint EliteGw;
        public static 
uint SkillTeam1;
        public static 
uint SkillTeam2;
        public static 
uint SkillTeam3;
        public static 
uint SkillTeam4;
        public static 
uint WeeklyPk;
        public static 
uint topguild;
        public static 
uint mrconquer;
        public static 
uint uniquepk;
        public static 
uint Portals;
        public static 
uint heroofgame;
        public static 
uint NobilityPrize;
        public static 
uint lastman;
        public static 
uint Daily;
        public static 
uint fbss;
        public static 
uint Poles;
        public static 
uint Clanwarday;
        public static 
uint soulp6;
        public static 
uint soulp7;
        public static 
uint changebody;
        public static 
uint ref6;
        public static 
uint Twar;
        public static 
uint stwar;
        public static 
uint ctf;
        public static 
uint cps;
        public static 
uint ClanwarCity;
        public static 
uint ClassPk;
        public static 
uint DeathMatchs;
        public static 
uint lobby;
        public static 
uint hunter;
        public static 
uint thief;
        public static 
uint housepromete;
        public static 
uint itembox;
        public static 
uint houseupgrade;
        public static 
uint MonthlyPk;
        public static 
uint TopSpouse;
        public static 
uint Bosses;
        public static 
uint Night;
        public static 
uint Broadcast;
        public static 
uint GuildFee;
        public static 
uint TeleportFee;
        public static 
uint DragonBall;
        public static 
uint Meteor;
        public static 
string VoteUrl;
        public static 
string coder "RaMbO";
        public static 
uint Reincarnation;
        public static 
uint donationrate;
        public static 
string servername get { return Constants.ServerName; } }
        public static 
void Load(IniFile IniFile)
        {
            
DragonBall IniFile.ReadUInt32("Rates""DragonBall");
            
Meteor IniFile.ReadUInt32("Rates""Meteor");
            
GuildWar IniFile.ReadUInt32("Rates""GuildWar");
            
EliteGw IniFile.ReadUInt32("Rates""questday");
            
Bosses IniFile.ReadUInt32("Rates""Bosses");
            
Broadcast IniFile.ReadUInt32("Rates""Broadcast");
            
TeleportFee IniFile.ReadUInt32("Rates""TeleportFee");
            
GuildFee IniFile.ReadUInt32("Rates""GuildFee");
            
king IniFile.ReadUInt32("Rates""king");
            
prince IniFile.ReadUInt32("Rates""prince");
            
Reincarnation IniFile.ReadUInt32("Rates""Reincarnation");
            
MonthlyPk IniFile.ReadUInt32("Rates""MonthlyPk");
            
TopSpouse IniFile.ReadUInt32("Rates""TopSpouse");
            
ChangeName IniFile.ReadUInt32("Rates""ChangeName");
            
housepromete IniFile.ReadUInt32("Rates""housepromete");
            
itembox IniFile.ReadUInt32("Rates""itembox");
            
Night IniFile.ReadUInt32("Rates""Night");
            
VoteUrl IniFile.ReadString("Rates""VoteUrl");
            
Portals IniFile.ReadUInt32("Rates""Portals");
            
coder IniFile.ReadString("Rates""coder");
            
SkillTeam1 IniFile.ReadUInt32("Rates""SkillTeam1");
            
SkillTeam2 IniFile.ReadUInt32("Rates""SkillTeam2");
            
SkillTeam3 IniFile.ReadUInt32("Rates""SkillTeam3");
            
SkillTeam4 IniFile.ReadUInt32("Rates""SkillTeam4");
            
soulp6 IniFile.ReadUInt32("Rates""soulp6");
            
soulp7 IniFile.ReadUInt32("Rates""soulp7");
            
ref6 IniFile.ReadUInt32("Rates""ref6");
            
changebody IniFile.ReadUInt32("Rates""changebody");
            
uniquepk IniFile.ReadUInt32("Rates""uniquepk");
            
WeeklyPk IniFile.ReadUInt32("Rates""WeeklyPk");
            
fbss IniFile.ReadUInt32("Rates""fbss");
            
Poles IniFile.ReadUInt32("Rates""Poles");
            
Clanwarday IniFile.ReadUInt32("Rates""Clanwarday");
            
lastman IniFile.ReadUInt32("Rates""lastman");
            
Daily IniFile.ReadUInt32("Rates""Daily");
            
topguild IniFile.ReadUInt32("Rates""topguild");
            
mrconquer IniFile.ReadUInt32("Rates""mrconquer");
            
NobilityPrize IniFile.ReadUInt32("Rates""NobilityPrize");
            
heroofgame IniFile.ReadUInt32("Rates""heroofgame");
            
Twar IniFile.ReadUInt32("Rates""Twar");
            
stwar IniFile.ReadUInt32("Rates""stwar");
            
ctf IniFile.ReadUInt32("Rates""ctf");
            
cps IniFile.ReadUInt32("Rates""cps");
            
ClanwarCity IniFile.ReadUInt32("Rates""ClanwarCity");
            
ClassPk IniFile.ReadUInt32("Rates""ClassPk");
            
DeathMatchs IniFile.ReadUInt32("Rates""DeathMatchs");
            
lobby IniFile.ReadUInt32("Rates""lobby");
            
hunter IniFile.ReadUInt32("Rates""hunter");
            
thief IniFile.ReadUInt32("Rates""thief");
            
donationrate IniFile.ReadUInt32("Rates""donationrate");
        }
    }


لو العيب منهوم يريت حد يقولي المشكلة في اي بظبط او يظبطلي الموضوع ده و ينزلي الورلد و البروجرم تاني