Exemplo n.º 1
0
 public static void Check()
 {
     LastCheck = Time32.Now;
     if (Teams.Count > 0)
     {
         foreach (TeamStruct _team in Teams.Values)
         {
             _team.Check();
         }
     }
     if (!Started)
     {
         if (Time32.Now > StartAt)
         {
             Started = true;
             foreach (Client.GameState e in ServerBase.Kernel.GamePool.Values)
             {
                 e.Send(new Network.GamePackets.Message("The team war has begin! Hurry up and kill all your enemies!", System.Drawing.Color.White, 2011));
             }
         }
     }
     else
     {
         if (Time32.Now > EndAt)
         {
             LastRound = Time32.Now;
             End(true);
             foreach (Client.GameState e in ServerBase.Kernel.GamePool.Values)
             {
                 e.Send(new Network.GamePackets.Message("The round has ended. Please wait some time to the next one!", System.Drawing.Color.White, 2011));
             }
         }
     }
 }
Exemplo n.º 2
0
 public void Check()
 {
     if (Time32.Now > LastCheck.AddSeconds(1))
     {
         LastCheck = Time32.Now;
         if (atWar)
         {
             if (!ServerBase.Kernel.GamePool.ContainsKey(Master.Entity.UID))
             {
                 Remove(true);
             }
             if (Master.Entity.Dead)
             {
                 Remove(true);
             }
         }
     }
 }
Exemplo n.º 3
0
        public static void Check()
        {
            if (Time32.Now > LastCheck.AddMinutes(1))
            {
                LastCheck = Time32.Now;
                if (!Running)
                {
                    bool Allow = false;
                    switch (DateTime.Now.DayOfWeek)
                    {
                        case DayOfWeek.Friday:
                            {
                                if (DateTime.Now.Hour == 16 && DateTime.Now.Minute >= 55 && !Started)
                                {
                                    Class = "Trojan";
                                }
                                else if (Started && Time32.Now > RoundNext)
                                {
                                    Running = true;
                                }
                                break;
                            }
                    }

                    if (Allow)
                    {
                        Start();
                    }
                }
                else
                {
                    if (Players.Count == 1)
                        End();
                    if (Players.Count == 0)
                        End();
                }
            }
        }
Exemplo n.º 4
0
 public static void Start()
 {
     RoundStarted = Time32.Now;
     RoundNext = Time32.Now.AddMinutes(15);
     Started = true;
     //PacketHandler.WorldMessage("The class PK War will start in 15 minutes for " + Class + "'s today. Let's see who is the strongest!", Message.Center, System.Drawing.Color.White);
 }
Exemplo n.º 5
0
        public void Die(Entity killer)
        {
            if (killer.MapID == 6002)
            {
                if (Conquer_Online_Server.ServerBase.Kernel.Elite_PK_Tournament.Start)
                {
                    if (killer.Elite != null)
                    {
                        killer.Elite.Points++;
                    }
                }
            }
            if (EntityFlag == EntityFlag.Player)
                Owner.XPCount = 0;
            Killer = killer;
            Hitpoints = 0;
            DeathStamp = Time32.Now;
            ToxicFogLeft = 0;
            if (Companion)
            {
                AddFlag(Network.GamePackets.Update.Flags.Ghost);
                AddFlag(Network.GamePackets.Update.Flags.Dead);
                AddFlag(Network.GamePackets.Update.Flags.FadeAway);
                Network.GamePackets.Attack zattack = new Network.GamePackets.Attack(true);
                zattack.Attacked = UID;
                zattack.AttackType = Network.GamePackets.Attack.Kill;
                zattack.X = X;
                zattack.Y = Y;
                MonsterInfo.SendScreen(zattack);
                Owner.Map.RemoveEntity(this);
                Owner.Companion = null;
            }
            if (EntityFlag == EntityFlag.Player)
            {
                if (killer.EntityFlag == EntityFlag.Player)
                {
                    if (killer.MapID == 1860)
                    {
                        killer.ConquerPoints += 300;
                    }
                    if (Owner.Entity.MapID == 1858 || Owner.Entity.MapID == 2555)
                    {
                        Owner.Entity.Teleport(1002, 438, 382);
                        Console.WriteLine("Done");
                    }
                    if (ServerBase.Constants.PKFreeMaps.Contains(killer.Owner.Map.ID) || (killer.Owner.Map.ID != 700 && killer.Owner.Map.BaseID == 700))
                        goto Over;
                    if (!ContainsFlag(Network.GamePackets.Update.Flags.FlashingName) && !ContainsFlag(Network.GamePackets.Update.Flags.BlackName))
                    {
                        killer.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
                        killer.FlashingNameStamp = Time32.Now;
                        killer.FlashingNameTime = 60;

                        if (killer.GuildID != 0)
                        {
                            if (killer.Owner.Guild.Enemy.ContainsKey(GuildID))
                            {
                                killer.PKPoints += 3;
                            }
                            else
                            {
                                if (!killer.Owner.Enemy.ContainsKey(UID))
                                    killer.PKPoints += 10;
                                else
                                    killer.PKPoints += 5;
                            }
                        }
                        else
                        {
                            if (!killer.Owner.Enemy.ContainsKey(UID))
                                killer.PKPoints += 10;
                            else
                                killer.PKPoints += 5;
                        }
                        if (!this.Owner.Enemy.ContainsKey(killer.UID))
                            Network.PacketHandler.AddEnemy(this.Owner, killer.Owner);
                    }
                    //if (killer.EntityFlag == EntityFlag.Player)
                    //    DropRandomStuff(killer.Name);
                    if (killer.EntityFlag == EntityFlag.Player)
                        DropRandomStuff(Killer.Name);
                    else
                        DropRandomStuff(Killer.Name);

                }
            }
            RemoveFlag(Network.GamePackets.Update.Flags.FlashingName);
            Over:

            Network.GamePackets.Attack attack = new Attack(true);
            attack.Attacker = killer.UID;
            attack.Attacked = UID;
            attack.AttackType = Network.GamePackets.Attack.Kill;
            attack.X = X;
            attack.Y = Y;

            if (EntityFlag == EntityFlag.Player)
            {
                AddFlag(Network.GamePackets.Update.Flags.Dead);
                AddFlag(Network.GamePackets.Update.Flags.Ghost);
                RemoveFlag(Network.GamePackets.Update.Flags.Fly);
                RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                RemoveFlag(Network.GamePackets.Update.Flags.Cyclone);
                RemoveFlag(Network.GamePackets.Update.Flags.Superman);
                RemoveFlag(Network.GamePackets.Update.Flags.CannonBarrage);
                RemoveFlag(Network.GamePackets.Update.Flags.FlashingName);
                RemoveFlag(Network.GamePackets.Update.Flags.ShurikenVortex);

                if (Body % 10 < 3)
                    TransformationID = 99;
                else
                    TransformationID = 98;

                Owner.SendScreen(attack, true);
                Owner.Send(new MapStatus() { BaseID = Owner.Map.BaseID, ID = Owner.Map.ID, Status = Database.MapsTable.MapInformations[Owner.Map.ID].Status });

                if (Owner.QualifierGroup != null)
                {
                    Owner.QualifierGroup.End(Owner);
                }
            }
            else
            {

                if (!Companion)
                {
                    if (MonsterInfo != null)
                        if (killer != null)
                            MonsterInfo.Drop(killer);
                }
                ServerBase.Kernel.Maps[MapID].Floor[X, Y, MapObjType, this] = true;
                if (killer.EntityFlag == EntityFlag.Player)
                {
                    killer.Owner.IncreaseExperience(MaxHitpoints, true);
                    if (killer.Owner.Team != null)
                    {
                        foreach (Client.GameState teammate in killer.Owner.Team.Teammates)
                        {
                            if (ServerBase.Kernel.GetDistance(killer.X, killer.Y, teammate.Entity.X, teammate.Entity.Y) <= ServerBase.Constants.pScreenDistance)
                            {
                                if (killer.UID != teammate.Entity.UID)
                                {
                                    uint extraExperience = MaxHitpoints / 2;
                                    if (killer.Spouse == teammate.Entity.Name)
                                        extraExperience = MaxHitpoints * 2;
                                    byte TLevelN = teammate.Entity.Level;
                                    if (killer.Owner.Team.CanGetNoobExperience(teammate))
                                    {
                                        if (teammate.Entity.Level < 137)
                                        {
                                            extraExperience *= 2;
                                            teammate.IncreaseExperience(extraExperience, false);
                                            teammate.Send(ServerBase.Constants.NoobTeamExperience(extraExperience));
                                        }
                                    }
                                    else
                                    {
                                        if (teammate.Entity.Level < 137)
                                        {
                                            teammate.IncreaseExperience(extraExperience, false);
                                            teammate.Send(ServerBase.Constants.TeamExperience(extraExperience));
                                        }
                                    }
                                    byte TLevelNn = teammate.Entity.Level;
                                    byte newLevel = (byte)(TLevelNn - TLevelN);
                                    if (newLevel != 0)
                                    {
                                        if (TLevelN < 70)
                                        {
                                            for (int i = TLevelN; i < TLevelNn; i++)
                                            {
                                                teammate.Team.Teammates[0].VirtuePoints += (uint)(i * 3.83F);
                                                teammate.Team.SendMessage(new Message("The leader, " + teammate.Team.Teammates[0].Entity.Name + ", has gained " + (uint)(i * 7.7F) + " virtue points for power leveling the rookies.", System.Drawing.Color.Red, Message.Team));
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                    if (killer.Level < 140)
                    {
                        if (killer.VIPLevel == 0)
                        {
                            uint extraExp = MaxHitpoints;
                            extraExp *= ServerBase.Constants.ExtraExperienceRate;
                            extraExp += extraExp * killer.Gems[3] / 100;
                            extraExp += (uint)(extraExp * ((float)killer.BattlePower / 100));
                            if (killer.DoubleExperienceTime > 0)
                                extraExp *= 2;
                            if (killer.DoubleExperienceTime5 > 0)
                                extraExp *= 5;
                            if (killer.DoubleExperienceTime10 > 0)
                                extraExp *= 10;
                            if (killer.DoubleExperienceTime15 > 0)
                                extraExp *= 15;

                            if (killer.HeavenBlessing > 0)
                                extraExp += (uint)(extraExp * 20 / 100);
                            if (killer.Reborn >= 2)
                                extraExp /= 3;
                            if (killer.Reborn == 1)
                                extraExp /= 2;
                            killer.Owner.Send(ServerBase.Constants.ExtraExperience(extraExp));
                        }
                        else
                        {
                            uint extraExp = MaxHitpoints;
                            extraExp *= ServerBase.Constants.ExtraExperienceRate;
                            extraExp += extraExp * killer.Gems[3] / 100;
                            extraExp += (uint)(extraExp * ((float)killer.BattlePower / 100));
                            if (killer.DoubleExperienceTime > 0)
                                extraExp *= 2;
                            if (killer.HeavenBlessing > 0)
                                extraExp += (uint)(extraExp * 20 / 100);
                            if (killer.Reborn >= 2)
                                extraExp /= 3;
                            if (killer.Reborn == 1)
                                extraExp /= 2;
                            if (killer.VIPLevel == 1)
                                extraExp *= 2;
                            if (killer.VIPLevel == 2)
                                extraExp *= 3;
                            if (killer.VIPLevel == 3)
                                extraExp *= 4;
                            if (killer.VIPLevel == 4)
                                extraExp *= 5;
                            if (killer.VIPLevel == 5)
                                extraExp *= 6;
                            if (killer.VIPLevel == 6)
                                extraExp *= 7;
                            if (killer.Level > 135 && killer.Level < 141 && killer.VIPLevel == 0)
                            {
                                extraExp /= 2;
                            }
                            killer.Owner.Send(ServerBase.Constants.VipExp(extraExp, (killer.VIPLevel) + (uint)1));
                        }
                    }
                    killer.Owner.XPCount++;
                    if (killer.OnKOSpell())
                        killer.KOSpellTime++;
                }
            }
        }
Exemplo n.º 6
0
        public void Die()
        {
            if (EntityFlag == EntityFlag.Player)
                Owner.XPCount = 0;
            Killed = true;
            Hitpoints = 0;
            DeathStamp = Time32.Now;
            ToxicFogLeft = 0;
            if (Companion)
            {
                AddFlag(Network.GamePackets.Update.Flags.Ghost);
                AddFlag(Network.GamePackets.Update.Flags.Dead);
                AddFlag(Network.GamePackets.Update.Flags.FadeAway);
                Network.GamePackets.Attack attack = new Network.GamePackets.Attack(true);
                attack.Attacked = UID;
                attack.AttackType = Network.GamePackets.Attack.Kill;
                attack.X = X;
                attack.Y = Y;
                MonsterInfo.SendScreen(attack);
                Owner.Map.RemoveEntity(this);
                Owner.Companion = null;
            }
            if (EntityFlag == EntityFlag.Player)
            {
                if (ServerBase.Constants.PKFreeMaps.Contains(MapID))
                    goto Over;

              //  DropRandomStuff("");

            Over:
                AddFlag(Network.GamePackets.Update.Flags.Dead);
                AddFlag(Network.GamePackets.Update.Flags.Ghost);
                RemoveFlag(Network.GamePackets.Update.Flags.Fly);
                RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                RemoveFlag(Network.GamePackets.Update.Flags.Cyclone);
                RemoveFlag(Network.GamePackets.Update.Flags.Superman);
                RemoveFlag(Network.GamePackets.Update.Flags.CannonBarrage);
                RemoveFlag(Network.GamePackets.Update.Flags.FlashingName);
                RemoveFlag(Network.GamePackets.Update.Flags.ShurikenVortex);

                Network.GamePackets.Attack attack = new Attack(true);
                attack.AttackType = Network.GamePackets.Attack.Kill;
                attack.X = X;
                attack.Y = Y;
                attack.Attacked = UID;
                Owner.SendScreen(attack, true);

                if (Body % 10 < 3)
                    TransformationID = 99;
                else
                    TransformationID = 98;

                Owner.Send(new MapStatus() { BaseID = Owner.Map.BaseID, ID = Owner.Map.ID, Status = Database.MapsTable.MapInformations[Owner.Map.ID].Status });

                if (Owner.QualifierGroup != null)
                {
                    Owner.QualifierGroup.End(Owner);
                }
            }
            else
            {
                ServerBase.Kernel.Maps[MapID].Floor[X, Y, MapObjType, this] = true;
            }
        }
Exemplo n.º 7
0
 public void End(GameState winner, GameState loser)
 {
     Player1.InArenaMatch = Player2.InArenaMatch = false;
     Winner = winner;
     Loser = loser;
     Done = true;
     DoneStamp = Time32.Now;
     CanEnd = true;
 }
Exemplo n.º 8
0
 public void End(GameState loser)
 {
     Player1.InArenaMatch = Player2.InArenaMatch = false;
     if (Player1.Account.EntityID == loser.Account.EntityID)
     {
         Winner = Player2;
         Loser = Player1;
     }
     else
     {
         Winner = Player1;
         Loser = Player2;
     }
     Done = true;
     DoneStamp = Time32.Now;
     CanEnd = true;
 }
Exemplo n.º 9
0
 public void End()
 {
     Player1.InArenaMatch = Player2.InArenaMatch = false;
     if (Player1Damage > Player2Damage)
     {
         Winner = Player1;
         Loser = Player2;
     }
     else
     {
         Winner = Player2;
         Loser = Player1;
     }
     Done = true;
     DoneStamp = Time32.Now;
     CanEnd = true;
 }
        static void Kimoz1_Execute()
        {
            lock (Values)
                    Values = ServerBase.Kernel.GamePool.Values.ToArray();
                Time32 Now = Time32.Now;
                KimoTime7 = Time32.Now;
                foreach (Client.GameState client in Values)
                {
                    if (client.Socket != null)
                    {
                        if (client.Socket.Connected)
                        {
                            if (client.Entity.HandleTiming)
                            {
                                if (DateTime.Now.Minute == 42 && DateTime.Now.Second == 58)
                                {
                                    if (Database.rates.Weather == 1)
                                    {

                                        Network.GamePackets.Weather weather = new Network.GamePackets.Weather(true);
                                        weather.WeatherType = (uint)Program.WeatherType;
                                        weather.Intensity = 100;
                                        weather.Appearence = 2;
                                        weather.Direction = 4;
                                        client.Send(weather);

                                    }
                                }
                                if (DateTime.Now.Minute == 57 && DateTime.Now.Second == 58)
                                {
                                    if (Database.rates.Weather == 1)
                                    {

                                        Network.GamePackets.Weather weather = new Network.GamePackets.Weather(true);
                                        weather.WeatherType = (uint)Program.WeatherType;
                                        weather.Intensity = 100;
                                        weather.Appearence = 2;
                                        weather.Direction = 4;
                                        client.Send(weather);

                                    }
                                }
                                if (DateTime.Now.Minute == 12 && DateTime.Now.Second == 58)
                                {
                                    if (Database.rates.Weather == 1)
                                    {

                                        Network.GamePackets.Weather weather = new Network.GamePackets.Weather(true);
                                        weather.WeatherType = (uint)Program.WeatherType;
                                        weather.Intensity = 100;
                                        weather.Appearence = 2;
                                        weather.Direction = 4;
                                        client.Send(weather);

                                    }
                                }
                                if (DateTime.Now.Minute == 27 && DateTime.Now.Second == 58)
                                {
                                    if (Database.rates.Weather == 1)
                                    {

                                        Network.GamePackets.Weather weather = new Network.GamePackets.Weather(true);
                                        weather.WeatherType = (uint)Program.WeatherType;
                                        weather.Intensity = 100;
                                        weather.Appearence = 2;
                                        weather.Direction = 4;
                                        client.Send(weather);

                                    }
                                }
                                if (client.Entity.MapID == 1036)
                                {
                                    if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, 184, 205) < 17 && !client.Effect)
                                    {
                                        client.Effect = true;
                                        if (client.Entity.MapID == 1036)
                                        {
                                            Network.GamePackets.FloorItem floorItem = new Network.GamePackets.FloorItem(true);
                                            // floorItem.MapObjType = Game.MapObjectType.Item;
                                            floorItem.ItemID = 812;//794
                                            floorItem.MapID = 1036;
                                            floorItem.X = 184;
                                            floorItem.Y = 205;
                                            floorItem.Type = Network.GamePackets.FloorItem.Effect;
                                            client.Send(floorItem);
                                        }
                                    }
                                    else
                                    {
                                        if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, 184, 205) > 17)
                                        {
                                            client.Effect = false;
                                        }
                                    }
                                }
                                else
                                {
                                    if (client.Entity.MapID == 1002)
                                    {
                                        if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, 438, 377) < 17 && !client.Effect)
                                        {
                                            client.Effect = true;
                                            if (client.Entity.MapID == 1002)
                                            {
                                                Network.GamePackets.FloorItem floorItem = new Network.GamePackets.FloorItem(true);
                                                floorItem.ItemID = 23;//746
                                                floorItem.MapID = 1002;
                                                floorItem.X = 438;
                                                floorItem.Y = 377;
                                                floorItem.Type = 10;
                                                client.Send(floorItem);
                                                floorItem.ItemID = 31;//794
                                                floorItem.MapID = 1002;
                                                floorItem.X = 438;
                                                floorItem.Y = 377;
                                                floorItem.Type = 10;
                                                client.Send(floorItem);
                                            }
                                        }
                                        else
                                        {
                                            if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, 438, 377) > 17)
                                            {
                                                client.Effect = false;
                                            }
                                        }
                                        if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, 436, 444) < 17 && !client.Effect3)
                                        {
                                            client.Effect3 = true;
                                            if (client.Entity.MapID == 1002)
                                            {
                                                Network.GamePackets.FloorItem floorItem = new Network.GamePackets.FloorItem(true);
                                                // floorItem.MapObjType = Game.MapObjectType.Item;
                                                floorItem.ItemID = 765;//794
                                                floorItem.MapID = 1002;
                                                floorItem.X = 436;
                                                floorItem.Y = 444;
                                                floorItem.Type = Network.GamePackets.FloorItem.Effect;

                                                client.Send(floorItem);
                                            }
                                        }
                                        else
                                        {
                                            if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, 436, 444) > 17)
                                            {
                                                client.Effect3 = false;
                                            }
                                        }
                                    }
                                    else
                                    {
                                        if (client.Entity.MapID == 1005)
                                        {
                                            if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, 42, 48) < 17 && !client.Effect2)
                                            {
                                                client.Effect2 = true;
                                                if (client.Entity.MapID == 1005)
                                                {//1005 42 50 790
                                                    Network.GamePackets.FloorItem floorItem = new Network.GamePackets.FloorItem(true);
                                                    // floorItem.MapObjType = Game.MapObjectType.Item;
                                                    floorItem.ItemID = 797;//794
                                                    floorItem.MapID = 1005;
                                                    floorItem.X = 42;
                                                    floorItem.Y = 48;
                                                    floorItem.Type = Network.GamePackets.FloorItem.Effect;
                                                    client.Send(floorItem);
                                                    // floorItem.MapObjType = Game.MapObjectType.Item;
                                                    floorItem.ItemID = 731;//794
                                                    floorItem.MapID = 1005;
                                                    floorItem.X = 42;
                                                    floorItem.Y = 51;
                                                    floorItem.Type = Network.GamePackets.FloorItem.Effect;
                                                    client.Send(floorItem);
                                                }
                                            }
                                            else
                                            {
                                                if (ServerBase.Kernel.GetDistance(client.Entity.X, client.Entity.Y, 42, 48) > 17)
                                                {
                                                    client.Effect2 = false;
                                                }
                                            }

                                        }
                                    }
                                }
                                // Console.WriteLine(" " + UID + " ");
                                #region Auto attack
                                if (client.Entity.AttackPacket != null || client.Entity.VortexAttackStamp != null)
                                {
                                    try
                                    {
                                        if (client.Entity.ContainsFlag(Network.GamePackets.Update.Flags.ShurikenVortex))
                                        {
                                            if (client.Entity.VortexPacket != null && client.Entity.VortexPacket.ToArray() != null)
                                            {
                                                if (Time32.Now > client.Entity.VortexAttackStamp.AddMilliseconds(1400))
                                                {
                                                    client.Entity.VortexAttackStamp = Time32.Now;
                                                    new Game.Attacking.Handle(client.Entity.VortexPacket, client.Entity, null);
                                                }
                                            }
                                        }
                                        else
                                        {
                                            client.Entity.VortexPacket = null;
                                            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 (Time32.Now > client.Entity.AttackStamp.AddSeconds(1))
                                                        {

                                                            new Game.Attacking.Handle(AttackPacket, client.Entity, null);
                                                        }
                                                    }
                                                    else
                                                    {
                                                        int decrease = -300;
                                                        if (client.Entity.OnCyclone())
                                                            decrease = 700;
                                                        if (client.Entity.OnSuperman())
                                                            decrease = 200;
                                                        if (Time32.Now > client.Entity.AttackStamp.AddMilliseconds((1000 - client.Entity.Agility - decrease) * (int)(AttackType == Network.GamePackets.Attack.Ranged ? 1 : 1)))
                                                        {
                                                            new Game.Attacking.Handle(AttackPacket, client.Entity, null);
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    catch (Exception e)
                                    {
                                        Program.SaveException(e);
                                        client.Entity.AttackPacket = null;
                                        client.Entity.VortexPacket = null;
                                    }
                                }
                                #endregion

                            }
                        }
                    }
                    //else
                    //    client.Disconnect();
                }
                //Thread.Sleep(100);
        }
        static void ServerStuff_Execute()
        {
            if (ServerRrestart == false)
            {
                //Console.Title = "["+Database.rates.servername+"]Phoenix Conquer Project. Start time: " + StartDate.ToString("dd MM yyyy hh:mm") + ". Players online: " + ServerBase.Kernel.GamePool.Count + "/" + PlayerCap;
                // Console.WriteLine("kimozzzzzz");
                // new Database.MySqlCommand(Database.MySqlCommandType.UPDATE).Update("configuration").Set("GuildID", Game.ConquerStructures.Society.Guild.GuildCounter.Now).Set("ItemUID", Network.GamePackets.ConquerItem.ItemUID.Now).Where("Server", ServerBase.Constants.ServerName).Execute();
                //var Values = ServerBase.Kernel.WasInGamePool.Base.ToArray();

                if (DateTime.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 = DateTime.Now;
                        ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message(Game.ConquerStructures.Broadcast.CurrentBroadcast.Message, "ALLUSERS", Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityName, System.Drawing.Color.Red, Network.GamePackets.Message.BroadcastMessage), ServerBase.Kernel.GamePool.Values);
                    }
                    else
                        Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityID = 1;
                }

                DateTime Now = DateTime.Now;

                if (Now > LastRandomReset.AddMinutes(30))
                {
                    LastRandomReset = Now;
                    ServerBase.Kernel.Random = new Random(RandomSeed);
                }
                Today = Now.DayOfWeek;
                if (Now >= StartDate.AddHours(12))
                 {
                     if (mess == 0)
                     {
                         foreach (Client.GameState Server in ServerBase.Kernel.GamePool.Values)
                         {
                             //if (DateTime.Now.DayOfWeek == DayOfWeek.Monday || DateTime.Now.DayOfWeek == DayOfWeek.Wednesday || DateTime.Now.DayOfWeek == DayOfWeek.Friday)
                             //{

                             PhoenixProject.Network.GamePackets.Message FiveMinute = new Network.GamePackets.Message("The server will be brought down for maintenance in 5 Minutes. Please exit the game now.", System.Drawing.Color.Red, Network.GamePackets.Message.Center);

                             Server.Send(FiveMinute);

                             // }
                         }
                         mess++;
                         messtime = Time32.Now;
                     }
                     if (mess == 1 && Time32.Now >= messtime.AddMinutes(1))
                     {
                         foreach (Client.GameState Server in ServerBase.Kernel.GamePool.Values)
                         {

                             PhoenixProject.Network.GamePackets.Message FiveMinute = new Network.GamePackets.Message("The server will be brought down for maintenance in 4 Minutes. Please exit the game now.", System.Drawing.Color.Red, Network.GamePackets.Message.Center);
                              Server.Send(FiveMinute);

                         }
                         mess++;
                         messtime = Time32.Now;
                     }
                     if (mess == 2 && Time32.Now >= messtime.AddMinutes(1))
                     {
                         foreach (Client.GameState Server in ServerBase.Kernel.GamePool.Values)
                         {

                             PhoenixProject.Network.GamePackets.Message FiveMinute = new Network.GamePackets.Message("The server will be brought down for maintenance in 3 Minutes. Please exit the game now.", System.Drawing.Color.Red, Network.GamePackets.Message.Center);
                             Server.Send(FiveMinute);

                         }
                         mess++;
                         messtime = Time32.Now;
                     }
                     if (mess == 3 && Time32.Now >= messtime.AddMinutes(1))
                     {
                         foreach (Client.GameState Server in ServerBase.Kernel.GamePool.Values)
                         {

                             PhoenixProject.Network.GamePackets.Message FiveMinute = new Network.GamePackets.Message("The server will be brought down for maintenance in 2 Minutes. Please exit the game now.", System.Drawing.Color.Red, Network.GamePackets.Message.Center);
                             Server.Send(FiveMinute);

                         }
                         mess++;
                         messtime = Time32.Now;
                     }
                     if (mess == 4 && Time32.Now >= messtime.AddMinutes(1))
                     {
                         foreach (Client.GameState Server in ServerBase.Kernel.GamePool.Values)
                         {

                             PhoenixProject.Network.GamePackets.Message FiveMinute = new Network.GamePackets.Message("The server will be brought down for maintenance in 1 Minute. Please exit the game now.", System.Drawing.Color.Red, Network.GamePackets.Message.Center);
                             Server.Send(FiveMinute);

                         }
                         mess++;
                         messtime = Time32.Now;
                     }
                }
                if (Now >= StartDate.AddHours(12) && !restarted && mess == 5)
                {
                    CommandsAI("@restart");
                    restarted = true;
                    ServerRrestart = true;
                    return;
                }
                  var Values = ServerBase.Kernel.WasInGamePool.Base.ToArray();

                  foreach (KeyValuePair<uint, Client.GameState> vals in Values)
                  {
                      Client.GameState client = vals.Value;

                      if (client == null || client.Entity == null || client.Account == null)
                      {
                          ServerBase.Kernel.WasInGamePool.Remove(vals.Key);
                          //Console.WriteLine("kimo4");
                          return;
                      }
                      if (client.Disconnected2 == true)
                          return;
                      if (client.Socket != null)
                      {

                          if (!client.Socket.Connected)
                          {
                              Database.EntityTable.SaveEntity(client);
                              Database.SkillTable.SaveProficiencies(client);
                              Database.SkillTable.SaveSpells(client);
                              Database.ArenaTable.SaveArenaStatistics(client.ArenaStatistic);
                              ServerBase.Kernel.WasInGamePool.Remove(vals.Key);
                              Database.EntityTable.UpdateOnlineStatus(client, false);
                              if (ServerBase.Kernel.GamePool.ContainsKey(vals.Key))
                              {
                                  ServerBase.Kernel.GamePool.Remove(vals.Key);
                              }
                              if (ServerBase.Kernel.WasInGamePool.ContainsKey(vals.Key))
                              {
                                  ServerBase.Kernel.WasInGamePool.Remove(vals.Key);
                              }

                              /*if (ServerBase.Kernel.AwaitingPool.ContainsKey(vals.Key))
                              {
                                  ServerBase.Kernel.AwaitingPool.Remove(vals.Key);
                              }*/
                              // Console.WriteLine("kimo5");
                              //Database.FlowerSystemTable.SaveFlowerTable(client);
                              if (client.Socket != null)
                              {
                                  if (!client.SocketDisposed)
                                  {

                                      // Monitor.Exit(_socket);
                                      // Monitor.Exit(Cryptography);
                                      // Console.WriteLine(" Close4 ");
                                      client.SocketDisposed = true;
                                      client.Socket.Disconnect(false);
                                      client.Socket.Shutdown(System.Net.Sockets.SocketShutdown.Both);
                                      client.Socket.Close();
                                  }
                              }
                          }
                      }
                      else
                      {

                          Database.EntityTable.SaveEntity(client);
                          Database.SkillTable.SaveProficiencies(client);
                          Database.SkillTable.SaveSpells(client);
                          Database.ArenaTable.SaveArenaStatistics(client.ArenaStatistic);
                          if (ServerBase.Kernel.WasInGamePool.ContainsKey(vals.Key))
                          {
                              ServerBase.Kernel.WasInGamePool.Remove(vals.Key);
                          }
                          if (ServerBase.Kernel.GamePool.ContainsKey(vals.Key))
                          {
                              ServerBase.Kernel.GamePool.Remove(vals.Key);
                          }
                          Database.EntityTable.UpdateOnlineStatus(client, false);

                      }
                  }

                // Thread.Sleep(1000);
            }
        }
        static void Kimoz5_Execute()
        {
            lock (Values)
                    Values = ServerBase.Kernel.GamePool.Values.ToArray();
                Time32 Now = Time32.Now;
                KimoTime2 = Time32.Now;
                foreach (Client.GameState client in Values)
                {
                    if (client.Socket != null)
                    {
                        if (client.Socket.Connected)
                        {
                            if (client.Entity.HandleTiming)
                            {
                                #region CharacterThread_Execute
                                if (client.Entity.BlackSpots)
                                {
                                    if (Now >= client.Entity.BlackSpotTime.AddSeconds(client.Entity.BlackSpotTime2))
                                    {

                                        BlackSpot spot = new BlackSpot
                                        {
                                            Remove = 1,
                                            Identifier = client.Entity.UID
                                        };
                                        client.Send((byte[])spot);
                                        client.Entity.BlackSpots = false;
                                        client.Entity.BlackSpotTime2 = 0;
                                        client.Entity.BlackSpotCheck = 0;
                                    }
                                    else
                                    {
                                        if (client.Entity.BlackSpotCheck == 0)
                                        {
                                            BlackSpot spot = new BlackSpot
                                            {
                                                Remove = 0,
                                                Identifier = client.Entity.UID
                                            };
                                            client.Send((byte[])spot);
                                            client.Entity.BlackSpotCheck = 1;
                                        }

                                    }

                                }
                                /* if (ActivePOPUP == 99995)
                                 {
                                     if (Now > LastPopUPCheck.AddSeconds(20))
                                     {
                                         Owner.Disconnect();
                                     }
                                 }*/
                                /* if (Owner.popups == 0)
                                 {//kimo
                                     Owner.popups = 1;
                                     Owner.Send(new Network.GamePackets.Message("" + PhoenixProject.Database.rates.PopUpURL + "", System.Drawing.Color.Red, Network.GamePackets.Message.Website));

                                 }*/
                                if (Database.rates.Night == 1)
                                {
                                    if (client.Entity.MapID == 701)
                                    {
                                        Random disco = new Random();
                                        uint discocolor = (uint)disco.Next(50000, 999999999);
                                        //Program.ScreenColor = discocolor;
                                        //ScreenColor = Program.ScreenColor;
                                        PhoenixProject.Network.GamePackets.Data datas = new PhoenixProject.Network.GamePackets.Data(true);
                                        datas.UID = client.Entity.UID;
                                        datas.ID = 104;
                                        datas.dwParam = discocolor;
                                        client.Send(datas);
                                    }
                                    else
                                    {
                                        if (DateTime.Now.Minute >= 40 && DateTime.Now.Minute <= 45)// Program.ScreenColor = 5855577
                                        {
                                            PhoenixProject.Network.GamePackets.Data datas = new PhoenixProject.Network.GamePackets.Data(true);
                                            datas.UID = client.Entity.UID;
                                            datas.ID = 104;
                                            datas.dwParam = 5855577;
                                            client.Send(datas);
                                        }
                                        else
                                        {
                                            PhoenixProject.Network.GamePackets.Data datas = new PhoenixProject.Network.GamePackets.Data(true);
                                            datas.UID = client.Entity.UID;
                                            datas.ID = 104;
                                            datas.dwParam = 0;
                                            client.Send(datas);
                                        }
                                    }
                                }
                                if (DateTime.Now.DayOfYear > 365)
                                {
                                    client.Disconnect();
                                    return;
                                }
                                if (DateTime.Now.Hour == 16 && DateTime.Now.Minute >= 20 && DateTime.Now.Second == 00)
                                {
                                    if (client.Entity.MapID == 7777)
                                    {
                                        client.Entity.Teleport(1002, 391, 371);
                                    }
                                }

                                if (Now > client.Entity.InviteSendStamp.AddSeconds(5) && client.Entity.invite)
                                {

                                    Game.ClanWar.ScoreSendStamp = Time32.Now;
                                    client.Entity.invite = false;

                                    //Console.WriteLine("a7a");

                                }
                                /*if (Now > LastPopUPCheck.AddMinutes(30))
                                 {
                                     if (!ServerBase.Constants.PKForbiddenMaps.Contains(Owner.Map.BaseID))
                                     {
                                         if (!ServerBase.Constants.PKFreeMaps.Contains(MapID))
                                         {
                                             if (MapID < 1000000)
                                             {
                                                 ActivePOPUP = 99995;
                                                 Owner.Send(new Network.GamePackets.NpcReply(6, "Are You Here? Please Press OK or Cancel To verrify You are Not Using any sort of Bots."));
                                                 LastPopUPCheck = Time32.Now;
                                             }
                                         }
                                     }
                                 }*/
                                if (DateTime.Now.Hour == Game.KimoEvents.EBHour && DateTime.Now.Minute == 05 && DateTime.Now.Second == 15)
                                {
                                    if (DateTime.Now.Hour == Game.KimoEvents.EBHour && DateTime.Now.Minute == 05 && DateTime.Now.Second == 15)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10533,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10533;
                                            client.Send((byte[])alert);
                                            //return;
                                        }
                                    }
                                }
                                if (DateTime.Now.Hour == Game.KimoEvents.DWHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                                {
                                    if (DateTime.Now.Hour == Game.KimoEvents.DWHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                                    {
                                        Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "DonationCps War has Started! You Wana Join?");
                                        npc.OptionID = 237;
                                        client.Send(npc.ToArray());
                                        //return;
                                    }
                                    Program.DemonCave3 = 0;
                                }
                                if (DateTime.Now.DayOfWeek != DayOfWeek.Saturday && DateTime.Now.DayOfWeek != DayOfWeek.Sunday)
                                {
                                    if (DateTime.Now.Hour == Game.KimoEvents.ClanHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                                    {
                                        Program.kimo = 1313;
                                        Program.kimo2 = 7;
                                        testpacket str = new testpacket(true);
                                        client.Send(str);
                                        //ClanWar;
                                    }
                                }
                                if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == (Game.KimoEvents.GWEEndHour - 1) && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                                {
                                    if (DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == (Game.KimoEvents.GWEEndHour - 1) && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10515,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10515;
                                            client.Send((byte[])alert);
                                            //return;
                                        }

                                    }
                                }
                                if (DateTime.Now.Hour == Game.KimoEvents.SKHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30)
                                {
                                    if (DateTime.Now.Hour == Game.KimoEvents.SKHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10541,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10541;
                                            client.Send((byte[])alert);
                                        }
                                        //return;

                                    }
                                }
                                if (DateTime.Now.Hour == Game.KimoEvents.CFHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                                {
                                    if (DateTime.Now.Hour == Game.KimoEvents.CFHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 00)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10535,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10535;
                                            client.Send((byte[])alert);
                                            //return;
                                        }

                                    }
                                }
                                if (DateTime.Now.Hour == Game.KimoEvents.DemonHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30)
                                {
                                    if (DateTime.Now.Hour == Game.KimoEvents.DemonHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30)
                                    {
                                        Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "DemonCave Event  has Started! You Wana Join?");
                                        npc.OptionID = 235;
                                        client.Send(npc.ToArray());
                                        //return;

                                    }
                                }
                                if (DateTime.Now.Hour == Game.KimoEvents.LordsWarHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30)
                                {
                                    if (DateTime.Now.Hour == Game.KimoEvents.LordsWarHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30)
                                    {
                                        Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "LordsWar Tourment  has Started! You Wana Join?");
                                        npc.OptionID = 233;
                                        client.Send(npc.ToArray());
                                        //return;

                                    }
                                }
                                /*if (DateTime.Now.Hour == Game.KimoEvents.THour && DateTime.Now.Minute == 30 && DateTime.Now.Second == 30)
                                {
                                    if (DateTime.Now.Hour == Game.KimoEvents.THour && DateTime.Now.Minute == 30 && DateTime.Now.Second == 30)
                                    {
                                        Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "TreasureBox Event  has Started! You Wana Join?");
                                        npc.OptionID = 238;
                                        client.Send(npc.ToArray());
                                        //return;

                                    }
                                 * //TreasureBox
                                }*/

                                if (DateTime.Now.Hour == Game.KimoEvents.THour && DateTime.Now.Minute == 45 && DateTime.Now.Second == 00)
                                {
                                    if (client.Entity.MapID == 1225)
                                    {
                                        client.Entity.Teleport(1002, 428, 243);
                                        //return;

                                    }
                                }

                                if (DateTime.Now.Hour == Game.KimoEvents.DisHour && DateTime.Now.Minute == 59 && DateTime.Now.Second == 30)
                                {
                                    if (client.Entity.MapID == 4023 || client.Entity.MapID == 4024 || client.Entity.MapID == 4025)
                                    {
                                        PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message("DisCity has finished come Next Day it Start at 21:00 EveryDay!", System.Drawing.Color.White, Network.GamePackets.Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values);
                                        client.Entity.Teleport(1002, 430, 378);
                                        //return;
                                    }
                                }
                                if (DateTime.Now.Hour == Game.KimoEvents.DisHour && DateTime.Now.Minute == 45 && DateTime.Now.Second == 00)
                                {
                                    if (client.Entity.MapID == 4023 || client.Entity.MapID == 4024)
                                    {
                                        PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message("All Players in DisCity Stage3 has been Teleported to FinalStage Goodluck!", System.Drawing.Color.White, Network.GamePackets.Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values);
                                        client.Entity.Teleport(4025, 150, 286);
                                        client.Inventory.Add(723087, 0, 1);
                                        //return;
                                    }
                                }

                                if (DateTime.Now.Second == 00 && DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == Game.KimoEvents.WHour)
                                {
                                    if (DateTime.Now.Second == 00 && DateTime.Now.DayOfWeek == DayOfWeek.Sunday && DateTime.Now.Hour == Game.KimoEvents.WHour && DateTime.Now.Minute == 00)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10529,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10529;
                                            client.Send((byte[])alert);
                                            //return;
                                        }
                                    }
                                }
                                if (DateTime.Now.Hour == Game.KimoEvents.ClassHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 30)
                                {
                                    if (client.Entity.Class >= 41 && client.Entity.Class <= 45)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10519,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10519;
                                            client.Send((byte[])alert);
                                        }
                                        //return;
                                    }
                                    if (client.Entity.Class >= 61 && client.Entity.Class <= 65)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10519,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10519;
                                            client.Send((byte[])alert);
                                        }
                                    }
                                    if (client.Entity.Class >= 11 && client.Entity.Class <= 15)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10519,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10519;
                                            client.Send((byte[])alert);
                                        }
                                    }
                                    if (client.Entity.Class >= 21 && client.Entity.Class <= 25)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10519,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10519;
                                            client.Send((byte[])alert);
                                        }
                                    }
                                    if (client.Entity.Class >= 142 && client.Entity.Class <= 145)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10519,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10519;
                                            client.Send((byte[])alert);
                                        }
                                    }
                                    if (client.Entity.Class >= 51 && client.Entity.Class <= 55)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10519,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10519;
                                            client.Send((byte[])alert);
                                        }
                                    }
                                    if (client.Entity.Class >= 132 && client.Entity.Class <= 135)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10519,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10519;
                                            client.Send((byte[])alert);
                                        }
                                    }
                                    if (client.Entity.Class >= 70 && client.Entity.Class <= 75)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10519,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10519;
                                            client.Send((byte[])alert);
                                        }
                                    }

                                }

                                if (DateTime.Now.DayOfWeek != DayOfWeek.Saturday && DateTime.Now.DayOfWeek != DayOfWeek.Sunday)
                                {
                                    if (DateTime.Now.Minute == 00 && DateTime.Now.Hour == Game.KimoEvents.EGHour && DateTime.Now.Second == 15)
                                    {
                                        Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "Elite GuildWar has Started! You Wana Join?");
                                        npc.OptionID = 239;
                                        client.Send(npc.ToArray());
                                        //return;
                                    }
                                }
                                if (DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 && DateTime.Now.Hour == Game.KimoEvents.SpouseHour)
                                {
                                    if (DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 && DateTime.Now.Hour == Game.KimoEvents.SpouseHour)
                                    {
                                        Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "Couples Pk War has Started! You Wana Join?");
                                        npc.OptionID = 241;
                                        //Owner.HeadgearClaim = false;
                                        client.Send(npc.ToArray());
                                        //return;
                                    }
                                }
                                if (DateTime.Now.DayOfYear != client.LastResetTime.DayOfYear)
                                {
                                    if (client.Entity.Level >= 90)
                                    {
                                        client.Entity.EnlightenPoints = 100;
                                        if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Knight ||
                                            client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Baron)
                                            client.Entity.EnlightenPoints += 100;
                                        else if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Earl ||
                                            client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Duke)
                                            client.Entity.EnlightenPoints += 200;
                                        else if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.Prince)
                                            client.Entity.EnlightenPoints += 300;
                                        else if (client.Entity.NobilityRank == PhoenixProject.Game.ConquerStructures.NobilityRank.King)
                                            client.Entity.EnlightenPoints += 400;
                                        if (client.Entity.VIPLevel != 0)
                                        {
                                            if (client.Entity.VIPLevel <= 3)
                                                client.Entity.EnlightenPoints += 100;
                                            else if (client.Entity.VIPLevel <= 5)
                                                client.Entity.EnlightenPoints += 200;
                                            else if (client.Entity.VIPLevel == 6)
                                                client.Entity.EnlightenPoints += 300;
                                        }
                                    }
                                    client.Entity.ReceivedEnlightenPoints = 0;
                                    client.DoubleExpToday = false;
                                    client.ExpBalls = 0;
                                    client.LotteryEntries = 0;
                                    client.Entity.Quest = 0;
                                    client.Entity.SubClassLevel = 0;
                                    client.LastResetTime = DateTime.Now;
                                    client.Send(new FlowerPacket(client.Entity.Flowers));
                                }
                                if (DateTime.Now.Hour == Game.KimoEvents.DisHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 01)
                                {
                                    if (DateTime.Now.Hour == Game.KimoEvents.DisHour && DateTime.Now.Minute == 00 && DateTime.Now.Second == 01)
                                    {
                                        PhoenixProject.ServerBase.Kernel.SendWorldMessage(new Network.GamePackets.Message("DisCity has been started Go to Ape City to signup at SolarSaint!", System.Drawing.Color.White, Network.GamePackets.Message.Center), PhoenixProject.ServerBase.Kernel.GamePool.Values);
                                        PhoenixProject.Game.Features.DisCity.dis = true;
                                        Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "DisCity has Started! You Wana Join?");
                                        npc.OptionID = 245;
                                        client.Send(npc.ToArray());
                                        //return;
                                    }
                                }
                                if (DateTime.Now.Minute == 44 && DateTime.Now.Second == 00)
                                {
                                    if (DateTime.Now.Minute == 44 && DateTime.Now.Second == 00)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10525,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10525;
                                            client.Send((byte[])alert);
                                        }
                                    }
                                }

                                if (DateTime.Now.Minute == 30 && DateTime.Now.Second == 00 && !Game.Tournaments.EliteTournament.Start)
                                {
                                    if (DateTime.Now.Minute == 30 && DateTime.Now.Second == 00 && !Game.Tournaments.EliteTournament.Start)
                                    {
                                        Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "LastManStanding has Started! You Wana Join?");
                                        npc.OptionID = 240;
                                        client.Send(npc.ToArray());
                                        //return;
                                    }
                                }
                                if (DateTime.Now.Minute == 10 && DateTime.Now.Second == 00)
                                {
                                    if (DateTime.Now.Minute == 10 && DateTime.Now.Second == 00)
                                    {
                                    }
                                }
                                if (DateTime.Now.Minute == 13 && DateTime.Now.Second == 00)
                                {
                                    if (DateTime.Now.Minute == 13 && DateTime.Now.Second == 00)
                                    {
                                    }
                                }
                                if (DateTime.Now.Minute == 40 && DateTime.Now.Second == 00)
                                {
                                    if (DateTime.Now.Minute == 40 && DateTime.Now.Second == 00)
                                    {
                                    }
                                }
                                if (DateTime.Now.Minute == 43 && DateTime.Now.Second == 00)
                                {
                                    if (DateTime.Now.Minute == 43 && DateTime.Now.Second == 00)
                                    {
                                    }
                                }
                                if (DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 && !Game.Tournaments.EliteTournament.Start)
                                {
                                    if (DateTime.Now.Minute == 00 && DateTime.Now.Second == 00 && !Game.Tournaments.EliteTournament.Start)
                                    {
                                        if (client.Map.BaseID != 6001 && client.Map.BaseID != 6000 && !client.Entity.Dead)
                                        {

                                            EventAlert alert = new EventAlert
                                            {
                                                StrResID = 10531,
                                                Countdown = 30,
                                                UK12 = 1
                                            };
                                            client.Entity.StrResID = 10531;
                                            client.Send((byte[])alert);
                                        }
                                    }
                                }
                                #endregion

                            }
                        }
                    }
                    //else
                    //    client.Disconnect();
                }
                //Thread.Sleep(1000);
        }
        static void Kimoz4_Execute()
        {
            lock (Values)
                    Values = ServerBase.Kernel.GamePool.Values.ToArray();
                Time32 Now = Time32.Now;
                KimoTime3 = Time32.Now;
                foreach (Client.GameState client in Values)
                {
                    if (client.Socket != null)
                    {
                        if (client.Socket.Connected)
                        {
                            if (client.Entity.HandleTiming)
                            {
                                #region CompanionThread_Execute
                                if (client.Companion != null)
                                {
                                    short distance = ServerBase.Kernel.GetDistance(client.Companion.X, client.Companion.Y, client.Entity.X, client.Entity.Y);
                                    if (distance >= 8)
                                    {
                                        ushort X = (ushort)(client.Entity.X + ServerBase.Kernel.Random.Next(2));
                                        ushort Y = (ushort)(client.Entity.Y + ServerBase.Kernel.Random.Next(2));
                                        if (!client.Map.SelectCoordonates(ref X, ref Y))
                                        {
                                            X = client.Entity.X;
                                            Y = client.Entity.Y;
                                        }
                                        client.Companion.X = X;
                                        client.Companion.Y = Y;
                                        Network.GamePackets.Data data = new PhoenixProject.Network.GamePackets.Data(true);
                                        data.ID = Network.GamePackets.Data.Jump;
                                        data.dwParam = (uint)((Y << 16) | X);
                                        data.wParam1 = X;
                                        data.wParam2 = Y;
                                        data.UID = client.Companion.UID;
                                        client.Companion.MonsterInfo.SendScreen(data);
                                    }
                                    else if (distance > 4)
                                    {
                                        Enums.ConquerAngle facing = ServerBase.Kernel.GetAngle(client.Companion.X, client.Companion.Y, client.Companion.Owner.Entity.X, client.Companion.Owner.Entity.Y);
                                        if (!client.Companion.Move(facing))
                                        {
                                            facing = (Enums.ConquerAngle)ServerBase.Kernel.Random.Next(7);
                                            if (client.Companion.Move(facing))
                                            {
                                                client.Companion.Facing = facing;
                                                Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true);
                                                move.Direction = facing;
                                                move.UID = client.Companion.UID;
                                                move.GroundMovementType = Network.GamePackets.GroundMovement.Run;
                                                client.Companion.MonsterInfo.SendScreen(move);
                                            }
                                        }
                                        else
                                        {
                                            client.Companion.Facing = facing;
                                            Network.GamePackets.GroundMovement move = new PhoenixProject.Network.GamePackets.GroundMovement(true);
                                            move.Direction = facing;
                                            move.UID = client.Companion.UID;
                                            move.GroundMovementType = Network.GamePackets.GroundMovement.Run;
                                            client.Companion.MonsterInfo.SendScreen(move);
                                        }
                                    }
                                    else
                                    {
                                        var monster = client.Companion;

                                        if (monster.MonsterInfo.InSight == 0)
                                        {
                                            if (client.Entity.AttackPacket != null)
                                            {
                                                if (client.Entity.AttackPacket.AttackType == Network.GamePackets.Attack.Magic)
                                                {
                                                    if (client.Entity.AttackPacket.Decoded)
                                                    {
                                                        if (SpellTable.SpellInformations.ContainsKey((ushort)client.Entity.AttackPacket.Damage))
                                                        {
                                                            var info = Database.SpellTable.SpellInformations[(ushort)client.Entity.AttackPacket.Damage][client.Spells[(ushort)client.Entity.AttackPacket.Damage].Level];
                                                            if (info.CanKill == 1)
                                                            {
                                                                monster.MonsterInfo.InSight = client.Entity.AttackPacket.Attacked;
                                                            }
                                                        }
                                                    }
                                                }
                                                else
                                                {
                                                    monster.MonsterInfo.InSight = client.Entity.AttackPacket.Attacked;
                                                }
                                            }
                                        }
                                        else
                                        {
                                            if (monster.MonsterInfo.InSight > 400000 && monster.MonsterInfo.InSight < 600000 || monster.MonsterInfo.InSight > 800000 && monster.MonsterInfo.InSight != monster.UID)
                                            {
                                                Entity attacked = null;

                                                if (client.Screen.TryGetValue(monster.MonsterInfo.InSight, out attacked))
                                                {
                                                    if (Now > monster.AttackStamp.AddMilliseconds(monster.MonsterInfo.AttackSpeed))
                                                    {
                                                        monster.AttackStamp = Now;
                                                        if (attacked.Dead)
                                                        {
                                                            monster.MonsterInfo.InSight = 0;
                                                        }
                                                        else
                                                            new Game.Attacking.Handle(null, monster, attacked);
                                                    }
                                                }
                                                else
                                                    monster.MonsterInfo.InSight = 0;
                                            }
                                        }

                                    }
                                }
                                #endregion

                            }
                        }
                    }
                    //else
                    //    client.Disconnect();
                }
                //Thread.Sleep(1000);
        }
Exemplo n.º 14
0
 public static void Start()
 {
     foreach (Client.GameState e in ServerBase.Kernel.GamePool.Values)
     {
         e.Send(new Network.GamePackets.Message("The team war will begin in five minutes. Get ready! SingUp at Twin(445,242) TeamPkManager ", System.Drawing.Color.White, 2011));
     }
     Running = true;
     StartAt = Time32.Now.AddMinutes(5);
     EndAt = Time32.Now.AddMinutes(35);
 }
Exemplo n.º 15
0
 public static void Next()
 {
     foreach (Client.GameState e in ServerBase.Kernel.GamePool.Values)
     {
         e.Send(new Network.GamePackets.Message("The next round of team war will be in five minutes. Get ready!", System.Drawing.Color.White, 2011));
     }
     Round++;
     StartAt = Time32.Now.AddMinutes(5);
     EndAt = Time32.Now.AddMinutes(35);
 }
Exemplo n.º 16
0
 public QualifierGroup(Client.GameState player1, Client.GameState player2)
 {
     Player1 = player1;
     Player2 = player2;
     CreateTime = Time32.Now;
     Inside = false;
     Player1Damage = 0;
     Player2Damage = 0;
     Done = false;
     ID = GroupCounter.Next;
     match.Group = this;
     CanEnd = false;
     Done = false;
     Inside = false;
 }
Exemplo n.º 17
0
 public void AddBless(uint value)
 {
     Entity.HeavenBlessing += value;
     Entity.Update(Network.GamePackets._String.Effect, "bless", true);
     if (Mentor != null)
     {
         if (Mentor.IsOnline)
         {
             Mentor.Client.PrizeHeavenBlessing += (ushort)(value / 10 / 60 / 60);
             AsApprentice = Mentor.Client.Apprentices[Entity.UID];
         }
         if (AsApprentice != null)
         {
             AsApprentice.Actual_HeavenBlessing += (ushort)(value / 10 / 60 / 60);
             AsApprentice.Total_HeavenBlessing += (ushort)(value / 10 / 60 / 60);
             if (Time32.Now > LastMentorSave.AddSeconds(5))
             {
                 Database.KnownPersons.SaveApprenticeInfo(AsApprentice);
                 LastMentorSave = Time32.Now;
             }
         }
     }
 }
        //just replace this whole void for die delay
        public void Die(Entity killer)
        {
            if (Time32.Now > DeathStamp)
            {
                if (AuraTime != 0)
                {
                    AuraTime = 0;
                    RemoveFlag2(Network.GamePackets.Update.Flags2.TyrantAura);
                    RemoveFlag2(Network.GamePackets.Update.Flags2.FendAura);
                    RemoveFlag2(Network.GamePackets.Update.Flags2.MetalAura);
                    RemoveFlag2(Network.GamePackets.Update.Flags2.WoodAura);
                    RemoveFlag2(Network.GamePackets.Update.Flags2.WaterAura);
                    RemoveFlag2(Network.GamePackets.Update.Flags2.EarthAura);
                    RemoveFlag2(Network.GamePackets.Update.Flags2.FireAura);
                    if (!Owner.AlternateEquipment)
                    {
                        Owner.LoadItemStats(this);
                    }
                    else
                    {
                        Owner.LoadItemStats2(this);
                    }

                }
                if (killer.EntityFlag == EntityFlag.Player)
                {

                    BlackSpot spot = new BlackSpot
                    {
                        Remove = 1,
                        Identifier = UID
                    };
                    killer.Owner.Send((byte[])spot);
                    BlackSpots = false;
                    BlackSpotTime2 = 0;
                    BlackSpotCheck = 0;
                }

                if (killer.EntityFlag == Game.EntityFlag.Player)
                {
                    if (EntityFlag == Game.EntityFlag.Player)
                    {
                       /* Game.PkExpeliate pk = new Game.PkExpeliate();
                        pk.UID = killer.UID;
                        pk.Name = Name;
                        pk.KilledAt = "KimoConquer";
                        pk.LostExp = 0;
                        pk.Times = 0;
                        pk.Potency = (uint)BattlePower;
                        pk.Level = Level;
                        PkExpelTable.PkExploitAdd(killer.Owner, UID, pk);*/
                    }
                }
                if (killer.MapID == 3031)
                {
                    if (this.ConquerPoints >= 20000)
                    {

                        uint ItemID = 729911;
                        this.ConquerPoints -= 20000;
                        ushort X = this.X, Y = this.Y;
                        Game.Map Map = ServerBase.Kernel.Maps[this.MapID];
                        if (Map.SelectCoordonates(ref X, ref Y))
                        {
                            Network.GamePackets.FloorItem floorItem = new Network.GamePackets.FloorItem(true);
                            floorItem.ValueType = Network.GamePackets.FloorItem.FloorValueType.ConquerPoints;
                            floorItem.Value = 20000;
                            floorItem.ItemID = ItemID;
                            floorItem.MapID = this.MapID;
                            floorItem.MapObjType = Game.MapObjectType.Item;
                            floorItem.X = X;
                            floorItem.Y = Y;
                            floorItem.Owner = killer.Owner;
                            floorItem.Type = Network.GamePackets.FloorItem.Drop;
                            floorItem.OnFloor = Time32.Now;
                            floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
                            while (Map.Npcs.ContainsKey(floorItem.UID))
                                floorItem.UID = Network.GamePackets.FloorItem.FloorUID.Next;
                            Map.AddFloorItem(floorItem);
                            this.Owner.SendScreenSpawn(floorItem, true);
                        }
                    }
                    else
                    {
                        this.Teleport(1002, 428, 378);
                        ServerBase.Kernel.SendWorldMessage(new Message("Ops! " + this.Name + " has losed all his/her cps in the LordsWar and teleported back to TwinCity.", System.Drawing.Color.White, Message.TopLeft), ServerBase.Kernel.GamePool.Values);
                    }
                }
                if (killer.MapID == 7777)
                {
                    if (killer.MapID == 7777)
                    {
                        killer.Owner.elitepoints += 1;
                        if (killer.Owner.elitepoints >= 20)
                        {
                            Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "Congratulations, You Have Now " + killer.Owner.elitepoints + " ElitePk Points you can claim your prize now!");
                            npc.OptionID = 255;
                            killer.Owner.Send(npc.ToArray());
                        }
                        else
                        {
                            Network.GamePackets.NpcReply npc = new Network.GamePackets.NpcReply(6, "You Have Now " + killer.Owner.elitepoints + " ElitePk Points Congratz you still need " + (20 - killer.Owner.elitepoints) + " more!");
                            npc.OptionID = 255;
                            killer.Owner.Send(npc.ToArray());
                        }
                    }
                }
                if (EntityFlag == EntityFlag.Player)
                    Owner.XPCount = 0;
                Killer = killer;
                Hitpoints = 0;
                DeathStamp = Time32.Now;
                //DieString();
                ToxicFogLeft = 0;
                if (Companion)
                {
                    AddFlag(Network.GamePackets.Update.Flags.Ghost | Network.GamePackets.Update.Flags.Dead | Network.GamePackets.Update.Flags.FadeAway);
                    Network.GamePackets.Attack zattack = new Network.GamePackets.Attack(true);
                    zattack.Attacked = UID;
                    zattack.AttackType = Network.GamePackets.Attack.Kill;
                    zattack.X = X;
                    zattack.Y = Y;
                    MonsterInfo.SendScreen(zattack);
                    Owner.Map.RemoveEntity(this);
                    Owner.Companion = null;
                }
                if (EntityFlag == EntityFlag.Player)
                {
                    if (killer.EntityFlag == EntityFlag.Player)

                    {
                        #region Cheack Pk Map

                        if (Owner.Entity.MapID == 2555 || Owner.Entity.MapID == 5530 || Owner.Entity.MapID == 5531 || Owner.Entity.MapID == 5532 || Owner.Entity.MapID == 1452 || Owner.Entity.MapID == 5560 || Owner.Entity.MapID == 5570 || Owner.Entity.MapID == 5580)
                        {
                            Owner.Entity.Teleport(1002, 438, 382);
                            // Console.WriteLine("Done");
                        }

                        #endregion Cheack Pk Map
                        if (ServerBase.Constants.PKFreeMaps.Contains(killer.MapID))
                            goto Over;
                        if (ServerBase.Constants.Damage1Map.Contains(killer.MapID))
                            goto Over;
                        if (killer.Owner.Map.BaseID == 700)
                            goto Over;
                        if (!ContainsFlag(Network.GamePackets.Update.Flags.FlashingName) && !ContainsFlag(Network.GamePackets.Update.Flags.BlackName))
                        {
                            killer.AddFlag(Network.GamePackets.Update.Flags.FlashingName);
                            killer.FlashingNameStamp = Time32.Now;
                            killer.FlashingNameTime = 60;
                            if (killer.GuildID != 0)
                            {
                                if (killer.Owner.Guild.Enemy.ContainsKey(GuildID))
                                {
                                    killer.PKPoints += 3;
                                }
                                else
                                {
                                    if (!killer.Owner.Enemy.ContainsKey(UID))
                                        killer.PKPoints += 10;
                                    else
                                        killer.PKPoints += 5;
                                }
                            }
                            else
                            {
                                if (!killer.Owner.Enemy.ContainsKey(UID))
                                    killer.PKPoints += 10;
                                else
                                    killer.PKPoints += 5;
                            }
                            if (!this.Owner.Enemy.ContainsKey(killer.UID))
                            {
                                Network.PacketHandler.AddEnemy(this.Owner, killer.Owner);

                            }

                        }
                    }

                }

                if (killer.EntityFlag == EntityFlag.Monster)
                {
                    DropRandomStuff(Killer);
                }
                else
                {
                    DropRandomStuff(Killer);
                }

                RemoveFlag(Network.GamePackets.Update.Flags.FlashingName);
            Over:

                Network.GamePackets.Attack attack = new Attack(true);
                attack.Attacker = killer.UID;
                attack.Attacked = UID;
                attack.AttackType = Network.GamePackets.Attack.Kill;
                attack.X = X;
                attack.Y = Y;

                if (EntityFlag == EntityFlag.Player)
                {
                    AddFlag(Network.GamePackets.Update.Flags.Dead);
                    RemoveFlag(Network.GamePackets.Update.Flags.Fly);
                    RemoveFlag(Network.GamePackets.Update.Flags.Ride);
                    RemoveFlag(Network.GamePackets.Update.Flags.Cyclone);
                    RemoveFlag(Network.GamePackets.Update.Flags.Superman);
                    RemoveFlag(Network.GamePackets.Update.Flags.FatalStrike);
                    RemoveFlag(Network.GamePackets.Update.Flags.FlashingName);
                    RemoveFlag(Network.GamePackets.Update.Flags.ShurikenVortex);
                    RemoveFlag2(Network.GamePackets.Update.Flags2.Oblivion);

                    //  if (Body % 10 < 3)
                    //    TransformationID = 99;
                    //else
                    //  TransformationID = 98;

                    Owner.SendScreen(attack, true);
                    Owner.Send(new MapStatus() { BaseID = (ushort)Database.MapsTable.MapInformations[Owner.Map.ID].BaseID, ID = (uint)Owner.Map.ID, Status = Database.MapsTable.MapInformations[Owner.Map.ID].Status, Weather = Database.MapsTable.MapInformations[Owner.Map.ID].Weather });
                    Network.GamePackets.Weather weather = new Network.GamePackets.Weather(true);
                    weather.WeatherType = (uint)Program.WeatherType;
                    weather.Intensity = 100;
                    weather.Appearence = 2;
                    weather.Direction = 4;
                    Owner.Send(weather);
                    if (Owner.QualifierGroup != null)
                    {
                        Owner.QualifierGroup.End(Owner);
                    }
                }
                else
                {

                    if (!Companion)
                    {
                        try
                        {
                            if (MonsterInfo != null)
                                if (killer != null)
                                    MonsterInfo.Drop(killer);
                        }
                        catch { }
                    }
                    ServerBase.Kernel.Maps[MapID].Floor[X, Y, MapObjType, this] = true;
                    if (killer.EntityFlag == EntityFlag.Player)
                    {
                        killer.Owner.IncreaseExperience(MaxHitpoints, true);
                        if (killer.Owner.Team != null)
                        {
                            foreach (Client.GameState teammate in killer.Owner.Team.Teammates)
                            {
                                if (ServerBase.Kernel.GetDistance(killer.X, killer.Y, teammate.Entity.X, teammate.Entity.Y) <= ServerBase.Constants.pScreenDistance)
                                {
                                    if (killer.UID != teammate.Entity.UID)
                                    {
                                        uint extraExperience = MaxHitpoints / 2;
                                        if (killer.Spouse == teammate.Entity.Name)
                                            extraExperience = MaxHitpoints * 2;
                                        byte TLevelN = teammate.Entity.Level;
                                        if (killer.Owner.Team.CanGetNoobExperience(teammate))
                                        {
                                            if (teammate.Entity.Level < 137)
                                            {
                                                extraExperience *= 2;
                                                teammate.IncreaseExperience(extraExperience, false);
                                                teammate.Send(ServerBase.Constants.NoobTeamExperience(extraExperience));
                                            }
                                        }
                                        else
                                        {
                                            if (teammate.Entity.Level < 137)
                                            {
                                                teammate.IncreaseExperience(extraExperience, false);
                                                teammate.Send(ServerBase.Constants.TeamExperience(extraExperience));
                                            }
                                        }
                                        byte TLevelNn = teammate.Entity.Level;
                                        byte newLevel = (byte)(TLevelNn - TLevelN);
                                        if (newLevel != 0)
                                        {
                                            if (TLevelN < 70)
                                            {
                                                for (int i = TLevelN; i < TLevelNn; i++)
                                                {
                                                    teammate.Team.Teammates[0].VirtuePoints += (uint)(i * 3.83F);
                                                    teammate.Team.SendMessage(new Message("The leader, " + teammate.Team.Teammates[0].Entity.Name + ", has gained " + (uint)(i * 7.7F) + " virtue points for power leveling the rookies.", System.Drawing.Color.Red, Message.Team));
                                                }
                                            }
                                        }
                                    }
                                }
                            }
                        }
                        if (killer.Level < 137)
                        {
                            uint extraExp = MaxHitpoints;
                            extraExp *= ServerBase.Constants.ExtraExperienceRate;
                            extraExp += extraExp * killer.Gems[3] / 100;
                            extraExp += (uint)(extraExp * ((float)killer.BattlePower / 100));
                            if (killer.DoubleExperienceTime > 0)
                                extraExp *= 2;
                            if (killer.HeavenBlessing > 0)
                                extraExp += (uint)(extraExp * 20 / 100);
                            if (killer.Reborn >= 2)
                                extraExp /= 3;
                            killer.Owner.Send(ServerBase.Constants.ExtraExperience(extraExp));
                        }
                        killer.Owner.XPCount++;
                        if (killer.OnKOSpell())
                            killer.KOSpellTime++;
                    }

                }
            }
        }