コード例 #1
0
        static void LoginMessages(Client.GameState client)
        {
            if (client.WentToComplete)
                return;
            Data datas = new Data(true);
            datas.UID = client.Entity.UID;
            datas.ID = 116;
            datas.dwParam = 1197;
            client.Send(datas);
            client.SocketDisposed = false;

            // client.Send(Unknown2078Packet.Create(0x4f999eba));
            // client.TimeStamps.LoggedInTime = DateTime.Now;
            client.Send(new byte[] { 8, 0, 0x1f, 8, 0, 0, 0, 0, 0x54, 0x51, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72 });

            client.Send(new byte[] {
                    0x1c, 1, 0x25, 4, 0, 0, 0x22, 0, 0x7a, 3, 0, 0, 0, 0, 0, 0,
                    0xb2, 2, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x8a, 2, 0, 0, 0, 0, 0, 0,
                    0x5b, 3, 0, 0, 0xff, 0xff, 0xff, 0xff, 90, 3, 0, 0, 0xff, 0xff, 0xff, 0xff,
                    0x59, 3, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x58, 3, 0, 0, 0xff, 0xff, 0xff, 0xff,
                    0x57, 3, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x56, 3, 0, 0, 0xff, 0xff, 0xff, 0xff,
                    0x55, 3, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x54, 3, 0, 0, 0xff, 0xff, 0xff, 0xff,
                    0x53, 3, 0, 0, 0xff, 0xff, 0xff, 0xff, 0x52, 3, 0, 0, 0xff, 0xff, 0xff, 0xff,
                    0x57, 2, 0, 0, 0, 0, 0, 0, 0x56, 2, 0, 0, 0, 0, 0, 0,
                    0x55, 2, 0, 0, 0, 0, 0, 0, 0x54, 2, 0, 0, 0, 0, 0, 0,
                    0x53, 2, 0, 0, 0, 0, 0, 0, 0x52, 2, 0, 0, 0, 0, 0, 0,
                    0x51, 2, 0, 0, 0, 0, 0, 0, 80, 2, 0, 0, 0, 0, 0, 0,
                    0x4f, 2, 0, 0, 0, 0, 0, 0, 0x4e, 2, 0, 0, 0, 0, 0, 0,
                    0xf3, 1, 0, 0, 0, 0, 0, 0, 0xf2, 1, 0, 0, 0, 0, 0, 0,
                    0xf1, 1, 0, 0, 0, 0, 0, 0, 240, 1, 0, 0, 0, 0, 0, 0,
                    0xef, 1, 0, 0, 0, 0, 0, 0, 0xee, 1, 0, 0, 0, 0, 0, 0,
                    0xed, 1, 0, 0, 0, 0, 0, 0, 0xec, 1, 0, 0, 0, 0, 0, 0,
                    0xeb, 1, 0, 0, 0, 0, 0, 0, 0xea, 1, 0, 0, 0, 0, 0, 0,
                    210, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x54, 0x51, 0x53, 0x65,
                    0x72, 0x76, 0x65, 0x72
                 });
            client.Send(new byte[] {
                    60, 0, 0x7e, 4, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x54, 0x51, 0x53, 0x65,
                    0x72, 0x76, 0x65, 0x72
                 });
            client.Send(new byte[] {
                    60, 0, 0x7e, 4, 3, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0x54, 0x51, 0x53, 0x65,
                    0x72, 0x76, 0x65, 0x72
                 });
            client.Send(new byte[] {
                    0x54, 0, 0x20, 5, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,
                    0, 0, 0, 0, 0x54, 0x51, 0x53, 0x65, 0x72, 0x76, 0x65, 0x72
                 });

            DateTime time2 = new DateTime(0x7b2, 1, 1);
            TimeSpan span = (TimeSpan)(client.Entity.LastLogin - time2.ToLocalTime());
            uint num = (uint)span.TotalSeconds - 3600;
            // uint num = (uint)client.Entity.LastLogin.ToFileTime();
            if (num == 0)
            {
                DateTime time3 = new DateTime(0x7b2, 1, 1);
                TimeSpan span3 = (TimeSpan)(DateTime.Now - time3.ToLocalTime());

                num = (uint)span3.TotalSeconds - 3600;
            }
            LastLogin login = new LastLogin
            {
                TotalSeconds = num,
                Type = ((client.Account.IP != string.Empty) && (client.Account.IP != client.Account.OldIP)) ? PhoenixProject.Network.GamePackets.LastLogin.LastLoginTypes.DifferentCity : PhoenixProject.Network.GamePackets.LastLogin.LastLoginTypes.LastLogin,
                Unknown = 1
            };
            client.Send((byte[])login);

            if (client.Spells.ContainsKey(3050))
            {
                if (client.Entity.SecondRebornClass == 15 && client.Entity.FirstRebornClass == 15)
                {
                    // client.AddSpell(new Spell(true) { ID = 3050 });
                }
                else
                {
                    if (client.Entity.SecondRebornClass == 15 && client.Entity.Class >= 10 && client.Entity.Class <= 15)
                    {
                        // client.AddSpell(new Spell(true) { ID = 3050 });
                    }
                    else
                    {
                        if (client.Entity.FirstRebornClass == 15 && client.Entity.Class >= 10 && client.Entity.Class <= 15)
                        {
                            // client.AddSpell(new Spell(true) { ID = 3050 });
                        }
                        else
                        {
                            client.RemoveSpell(new Spell(true) { ID = 3050 });
                        }
                    }
                }
            }

            if (client.Spells.ContainsKey(11100))
            {
                if (client.Entity.SecondRebornClass == 75 && client.Entity.FirstRebornClass == 75)
                {
                    // client.AddSpell(new Spell(true) { ID = 3050 });
                }
                else
                {
                    if (client.Entity.SecondRebornClass == 75 && client.Entity.Class >= 70 && client.Entity.Class <= 75)
                    {
                        // client.AddSpell(new Spell(true) { ID = 3050 });
                    }
                    else
                    {
                        if (client.Entity.FirstRebornClass == 75 && client.Entity.Class >= 70 && client.Entity.Class <= 75)
                        {
                            // client.AddSpell(new Spell(true) { ID = 3050 });
                        }
                        else
                        {
                            client.RemoveSpell(new Spell(true) { ID = 11100 });
                        }
                    }
                }
            }

            if (client.Spells.ContainsKey(11050))
            {
                if (client.Spells[11050].Level > 0)
                {
                    client.RemoveSpell(new Spell(true) { ID = 11050 });
                    client.AddSpell(new Spell(true) { ID = 11050 });
                }
            }

            if (client.Entity.Class >= 50 && client.Entity.Class <= 55)
            {
                if (!client.Spells.ContainsKey(11230))
                {
                    client.AddSpell(new Spell(true) { ID = 11230 });
                }
            }
            else
            {
                if (client.Spells.ContainsKey(11230))
                {
                    client.RemoveSpell(new Spell(true) { ID = 11230 });
                }

            }

            if (client.Entity.Class >= 142 && client.Entity.Class <= 145 && client.Entity.FirstRebornClass == 145 && client.Entity.SecondRebornClass == 145)
            {
                if (!client.Spells.ContainsKey(10310))
                {
                    client.AddSpell(new Spell(true) { ID = 10310 });
                }
            }
            else
            {
                if (client.Spells.ContainsKey(10310))
                {
                    client.RemoveSpell(new Spell(true) { ID = 10310 });
                }

            }

            if (client.Entity.Class >= 132 && client.Entity.Class <= 135 && client.Entity.FirstRebornClass == 135 && client.Entity.SecondRebornClass == 135)
            {
                if (!client.Spells.ContainsKey(30000))
                {
                    client.AddSpell(new Spell(true) { ID = 30000 });
                }
            }
            else
            {
                if (client.Spells.ContainsKey(30000))
                {
                    client.RemoveSpell(new Spell(true) { ID = 30000 });
                }

            }

            if (client.Entity.Class >= 70 && client.Entity.Class <= 75 && client.Entity.FirstRebornClass == 75 && client.Entity.SecondRebornClass == 75)
            {
                if (!client.Spells.ContainsKey(11040))
                {
                    client.AddSpell(new Spell(true) { ID = 11040 });
                }
            }
            else
            {
                if (client.Spells.ContainsKey(11040))
                {
                    client.RemoveSpell(new Spell(true) { ID = 11040 });
                }

            }

            if (client.Entity.Class >= 50 && client.Entity.Class <= 55 && client.Entity.FirstRebornClass <= 55 && client.Entity.FirstRebornClass >= 50 && client.Entity.SecondRebornClass <= 55 && client.Entity.SecondRebornClass >= 50)
            {
                if (!client.Spells.ContainsKey(6003))
                {
                    client.AddSpell(new Spell(true) { ID = 6003 });
                }
            }
            else
            {
                if (client.Spells.ContainsKey(6003))
                {
                    client.RemoveSpell(new Spell(true) { ID = 6003 });
                }

            }
            if (client.Entity.Class >= 60 && client.Entity.Class <= 65 && client.Entity.FirstRebornClass <= 65 && client.Entity.FirstRebornClass >= 60 && client.Entity.SecondRebornClass <= 65 && client.Entity.SecondRebornClass >= 60)
            {
                if (!client.Spells.ContainsKey(10405))
                {
                    client.AddSpell(new Spell(true) { ID = 10405 });
                }
            }
            else
            {
                if (client.Spells.ContainsKey(10405))
                {
                    client.RemoveSpell(new Spell(true) { ID = 10405 });
                }

            }

            if (client.Entity.Class >= 40 && client.Entity.Class <= 45 && client.Entity.FirstRebornClass <= 45 && client.Entity.FirstRebornClass >= 40 && client.Entity.SecondRebornClass <= 45 && client.Entity.SecondRebornClass >= 40)
            {
                if (!client.Spells.ContainsKey(10313))
                {
                    client.AddSpell(new Spell(true) { ID = 10313 });
                }
            }
            else
            {
                if (client.Spells.ContainsKey(10313))
                {
                    client.RemoveSpell(new Spell(true) { ID = 10313 });
                }

            }
            if (client.Entity.Class >= 20 && client.Entity.Class <= 25 && client.Entity.FirstRebornClass <= 25 && client.Entity.FirstRebornClass >= 20 && client.Entity.SecondRebornClass <= 25 && client.Entity.SecondRebornClass >= 20)
            {
                if (!client.Spells.ContainsKey(10311))
                {
                    client.AddSpell(new Spell(true) { ID = 10311 });
                }
            }
            else
            {
                if (client.Spells.ContainsKey(10311))
                {
                    client.RemoveSpell(new Spell(true) { ID = 10311 });
                }

            }

            if (client.Entity.Class >= 10 && client.Entity.Class <= 15 && client.Entity.FirstRebornClass <= 15 && client.Entity.FirstRebornClass >= 10 && client.Entity.SecondRebornClass <= 15 && client.Entity.SecondRebornClass >= 10)
            {
                if (!client.Spells.ContainsKey(10315))
                {
                    client.AddSpell(new Spell(true) { ID = 10315 });
                }
            }
            else
            {
                if (client.Spells.ContainsKey(10315))
                {
                    client.RemoveSpell(new Spell(true) { ID = 10315 });
                }

            }

            if (client.Entity.Class >= 40 && client.Entity.Class <= 45)
            {
                if (client.Spells.ContainsKey(1025))
                {
                    client.RemoveSpell(new Spell(true) { ID = 1025 });//SuperMan
                }
            }
            if (client.Entity.Class >= 142 && client.Entity.Class <= 145)
            {
                if (client.Spells.ContainsKey(6002))
                {
                    client.RemoveSpell(new Spell(true) { ID = 6002 });//PiosnStar
                }
            }
            client.WentToComplete = true;
            client.Entity.SendUpdates = true;
            foreach (Interfaces.IConquerItem item in client.Inventory.Objects)
            {
                item.Send(client);
            }
            foreach (Interfaces.IConquerItem item in client.Equipment.Objects)
                if (item != null)
                {
                    if (Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID))
                    {
                        item.Send(client);
                        ItemUsage usage = new ItemUsage(true) { ID = ItemUsage.EquipItem };
                        usage.UID = item.UID;
                        usage.dwParam = item.Position;
                        client.Send(usage);
                        client.LoadItemStats(client.Entity);
                        client.CalculateStatBonus();
                        client.CalculateHPBonus();
                    }
                    else
                    {
                        client.Equipment.DestroyArrow(item.Position);
                    }
                }

            client.LoadItemStats(client.Entity);
            client.CalculateStatBonus();
            client.CalculateHPBonus();
            client.Equipment.UpdateEntityPacket();
            ClientEquip equips = new ClientEquip();
            equips.DoEquips(client);
            client.Send(equips);
            foreach (var Guild in ServerBase.Kernel.Guilds.Values)
            {
                Guild.SendName(client);
            }
            if (client.Entity.ClanId != 0 && client.Entity.ClanRank != 0 && client.Entity.ClanName != "")
            {
                if (client.Entity.Myclan != null)
                {
                    Network.GamePackets.Clan cl = new PhoenixProject.Network.GamePackets.Clan(client, 1);
                    client.Send(cl.ToArray());
                }
            }
            ServerTime time = new ServerTime();
            time.Year = (uint)DateTime.Now.Year;
            time.Month = (uint)DateTime.Now.Month;
            time.DayOfYear = (uint)DateTime.Now.DayOfYear;
            time.DayOfMonth = (uint)DateTime.Now.Day;
            time.Hour = (uint)DateTime.Now.Hour;
            time.Minute = (uint)DateTime.Now.Minute;
            time.Second = (uint)DateTime.Now.Second;
            client.Send(time);

            client.Entity.DoubleExperienceTime = (ushort)(client.Entity.DoubleExperienceTime + (1 - 1));
            client.Entity.HeavenBlessing = (ushort)(client.Entity.HeavenBlessing + (1 - 1));

            if (client.Mentor != null)
            {
                if (client.Mentor.IsOnline)
                {
                    MentorInformation Information = new MentorInformation(true);
                    Information.Mentor_Type = 1;
                    Information.Mentor_ID = client.Mentor.Client.Entity.UID;
                    Information.Apprentice_ID = client.Entity.UID;
                    Information.Enrole_Date = client.Mentor.EnroleDate;
                    Information.Mentor_Level = client.Mentor.Client.Entity.Level;
                    Information.Mentor_Class = client.Mentor.Client.Entity.Class;
                    Information.Mentor_PkPoints = client.Mentor.Client.Entity.PKPoints;
                    Information.Mentor_Mesh = client.Mentor.Client.Entity.Mesh;
                    Information.Mentor_Online = true;
                    Information.Shared_Battle_Power = (uint)(((client.Mentor.Client.Entity.BattlePower - client.Mentor.Client.Entity.ExtraBattlePower) - (client.Entity.BattlePower - client.Entity.ExtraBattlePower)) / 3.3F);
                    Information.String_Count = 3;
                    Information.Mentor_Name = client.Mentor.Client.Entity.Name;
                    Information.Apprentice_Name = client.Entity.Name;
                    Information.Mentor_Spouse_Name = client.Mentor.Client.Entity.Spouse;
                    client.ReviewMentor();
                    client.Send(Information);

                    ApprenticeInformation AppInfo = new ApprenticeInformation();
                    AppInfo.Apprentice_ID = client.Entity.UID;
                    AppInfo.Apprentice_Level = client.Entity.Level;
                    AppInfo.Apprentice_Class = client.Entity.Class;
                    AppInfo.Apprentice_PkPoints = client.Entity.PKPoints;
                    AppInfo.Apprentice_Experience = client.AsApprentice.Actual_Experience;
                    AppInfo.Apprentice_Composing = client.AsApprentice.Actual_Plus;
                    AppInfo.Apprentice_Blessing = client.AsApprentice.Actual_HeavenBlessing;
                    AppInfo.Apprentice_Name = client.Entity.Name;
                    AppInfo.Apprentice_Online = true;
                    AppInfo.Apprentice_Spouse_Name = client.Entity.Spouse;
                    AppInfo.Enrole_date = client.Mentor.EnroleDate;
                    AppInfo.Mentor_ID = client.Mentor.ID;
                    AppInfo.Mentor_Mesh = client.Mentor.Client.Entity.Mesh;
                    AppInfo.Mentor_Name = client.Mentor.Name;
                    AppInfo.Type = 2;
                    client.Mentor.Client.Send(AppInfo);
                }
                else
                {
                    MentorInformation Information = new MentorInformation(true);
                    Information.Mentor_Type = 1;
                    Information.Mentor_ID = client.Mentor.ID;
                    Information.Apprentice_ID = client.Entity.UID;
                    Information.Enrole_Date = client.Mentor.EnroleDate;
                    Information.Mentor_Online = false;
                    Information.String_Count = 2;
                    Information.Mentor_Name = client.Mentor.Name;
                    Information.Apprentice_Name = client.Entity.Name;

                    client.Send(Information);
                }
            }
            NobilityInfo update = new NobilityInfo(true);
            update.Type = NobilityInfo.Icon;
            update.dwParam = client.NobilityInformation.EntityUID;
            update.UpdateString(client.NobilityInformation);
            client.Send(update);
            client.Entity.Update(Update.Merchant, 255, false);

            foreach (Interfaces.IConquerItem item in client.Inventory.Objects)
                item.Send(client);

            foreach (Interfaces.IConquerItem item in client.Equipment.Objects)
                if (item != null)
                {
                    if (Database.ConquerItemInformation.BaseInformations.ContainsKey(item.ID))
                    {
                        item.Send(client);
                        //kimoSystem.Threading.Thread.Sleep(1);
                        // item.Send(client);

                    }
                    else
                    {
                        client.Equipment.DestroyArrow(item.Position);
                        Console.WriteLine("Announcement: Item have been removed because of invalid info. UID: " + item.UID + ". OWNER: " + client.Entity.Name);
                    }
                }
            client.LoadItemStats(client.Entity);
            client.CalculateStatBonus();
            client.CalculateHPBonus();
            if (!client.Equipment.Free(5))
            {
                if (IsArrow(client.Equipment.TryGetItem(5).ID))
                {
                    if (client.Equipment.Free(4))
                        client.Equipment.DestroyArrow(5);
                    else
                    {
                        client.Equipment.Remove(5);
                    }
                }
            }
            client.GemAlgorithm();
            client.CalculateStatBonus();
            client.CalculateHPBonus();
            client.Entity.Stamina = 100;

            client.Send(new Message(String.Format(
             "Welcome in " + PhoenixProject.Database.rates.servername + " - Legends Return Season III", client.Entity.Name,
             client.Entity.LastLogin.ToLongDateString().Replace('-', ' '),
             client.Entity.LastLogin.ToLongTimeString()), System.Drawing.Color.Red,
             Message.Service));
            client.Entity.UpdateEffects(true);

            // client.Send(new Message("Welcome in "+Database.rates.servername+"", System.Drawing.Color.Red, Message.Middle));

            if (client.Entity.VIPLevel > 0)
            {
                Network.GamePackets.VipStatus vip = new Network.GamePackets.VipStatus();
                client.Send(vip.ToArray());
            }
            client.Send(new MapStatus() { BaseID = (ushort)client.Map.BaseID, ID = (uint)client.Map.ID, Status = Database.MapsTable.MapInformations[client.Map.ID].Status, Weather = Database.MapsTable.MapInformations[client.Map.ID].Weather });

            if (client.Entity.Hitpoints == 0)
                client.Entity.Hitpoints = 1;
            client.Entity.VIPLevel = (byte)(client.Entity.VIPLevel + 0);
            client.Entity.HandleTiming = true;
            if (client.Entity.GuildSharedBp != 0)
                client.Entity.Update(Network.GamePackets.Update.GuildShareBP, client.Entity.GuildSharedBp, false);

            if (client.Entity.ExtraBattlePower != 0)
                client.Entity.Update(Network.GamePackets.Update.ExtraBattlePower, client.Entity.ExtraBattlePower, false);
            if (client.Guild != null)
                client.Guild.SendAllyAndEnemy(client);
            if (Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityID > 2)
                client.Send(new Network.GamePackets.Message(Game.ConquerStructures.Broadcast.CurrentBroadcast.Message, "ALLUSERS", Game.ConquerStructures.Broadcast.CurrentBroadcast.EntityName, System.Drawing.Color.Red, Network.GamePackets.Message.BroadcastMessage));
            client.Entity.Update(Network.GamePackets.Update.LuckyTimeTimer, (byte)client.BlessTime, false);
            if (client.Entity.HeavenBlessing != 0)
                client.Entity.Update(Network.GamePackets.Update.OnlineTraining, client.OnlineTrainingPoints, false);
            if (client.ClaimableItem.Count > 0)
                foreach (var item in client.ClaimableItem.Values)
                    item.Send(client);
            if (client.DeatinedItem.Count > 0)
                foreach (var item in client.DeatinedItem.Values)
                    item.Send(client);
            if (client.ItemGive == true)
            {
                client.Inventory.Add(1001010, 0, 5);
                if (client.Entity.Class != 70)
                {
                    client.Inventory.AddandWear(132008, 0, 1, client);

                }
                else
                {
                    client.Inventory.AddandWear(132008, 0, 1, client);
                }
                if (client.Entity.Class == 10 || client.Entity.Class == 20)
                {
                    client.Inventory.AddandWear(410301, 0, 1, client);

                }
                if (client.Entity.Class >= 100)
                {
                    client.Inventory.AddandWear(421301, 0, 1, client);

                }
                if (client.Entity.Class == 70)
                {
                    client.Inventory.AddandWear(611301, 0, 1, client);

                }
                if (client.Entity.Class == 60)
                {
                    client.Inventory.AddandWear(610301, 0, 1, client);

                }
                if (client.Entity.Class == 50)
                {
                    client.Inventory.AddandWear(601301, 0, 1, client);

                }
                if (client.Entity.Class == 40)
                {
                    client.Inventory.AddandWear(500301, 0, 1, client);

                }
                client.ItemGive = false;
            }
            client.Entity.RacePoints = client.Entity.RacePoints;
            send1136(client);
            client.Equipment.UpdateEntityPacket();
        }
コード例 #2
0
        public static void Sort(uint updateUID)
        {
            SortedDictionary<ulong, SortEntry<uint, NobilityInformation>> sortdict = new SortedDictionary<ulong, SortEntry<uint, NobilityInformation>>();

            foreach (NobilityInformation info in Board.Values)
            {
                if (sortdict.ContainsKey(info.Donation))
                {
                    SortEntry<uint, NobilityInformation> entry = sortdict[info.Donation];
                    entry.Values.Add(info.EntityUID, info);
                }
                else
                {
                    SortEntry<uint, NobilityInformation> entry = new SortEntry<uint, NobilityInformation>();
                    entry.Values = new Dictionary<uint, NobilityInformation>();
                    entry.Values.Add(info.EntityUID, info);
                    sortdict.Add(info.Donation, entry);
                }
            }

            SafeDictionary<uint, NobilityInformation> sortedBoard = new SafeDictionary<uint, NobilityInformation>(1000000);
            sortedBoard.Clear();
            int Place = 0;
            foreach (KeyValuePair<ulong, SortEntry<uint, NobilityInformation>> entries in sortdict.Reverse())
            {
                foreach (KeyValuePair<uint, NobilityInformation> value in entries.Value.Values)
                {
                    Client.GameState client = null;
                    try
                    {
                        int previousPlace = value.Value.Position;
                        value.Value.Position = Place;
                        NobilityRank Rank = NobilityRank.Serf;

                        if (Place > 100)
                        {
                            if (value.Value.Donation >= 200000000)
                            {
                                Rank = NobilityRank.Earl;
                            }
                            else if (value.Value.Donation >= 100000000)
                            {
                                Rank = NobilityRank.Baron;
                            }
                            else if (value.Value.Donation >= 30000000)
                            {
                                Rank = NobilityRank.Knight;
                            }
                        }
                        else
                        {
                            if (Place < PhoenixProject.Database.rates.king)
                            {
                                //PhoenixProject.ServerBase.Kernel.SendWorldMessage(new PhoenixProject.Network.GamePackets.Message("Congratulation! " + client.Entity.Name + "Donation To King in Nobility Rank!", System.Drawing.Color.White, 2011), PhoenixProject.ServerBase.Kernel.GamePool.Values);
                                Rank = NobilityRank.King;
                                //PhoenixProject.Clan.nobmas(client);
                                // ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + "Donation To King/Queen in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values);
                                //Rank = NobilityRank.King;
                            }
                            else if (Place < PhoenixProject.Database.rates.prince)
                            {
                                Rank = NobilityRank.Prince;
                                //PhoenixProject.Clan.nobmas(client);
                                // ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + "Donation To Prince in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values);
                                // Rank = NobilityRank.Prince;
                            }
                            else
                            {
                                Rank = NobilityRank.Duke;
                                //PhoenixProject.Clan.nobmas(client);
                                //ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + "Donation To Duke in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values);
                                //Rank = NobilityRank.Duke;
                            }
                        }
                        var oldRank = value.Value.Rank;
                        value.Value.Rank = Rank;
                        if (ServerBase.Kernel.GamePool.TryGetValue(value.Key, out client))
                        {
                            bool updateTheClient = false;
                            if (oldRank != Rank)
                            {
                                updateTheClient = true;
                                if (Rank == NobilityRank.Baron)
                                {
                                    ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Baron in Nobility Rank.", System.Drawing.Color.White, Message.TopLeft), ServerBase.Kernel.GamePool.Values);
                                }
                                if (Rank == NobilityRank.Earl)
                                {
                                    ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Earl in Nobility Rank.", System.Drawing.Color.White, Message.TopLeft), ServerBase.Kernel.GamePool.Values);
                                }
                                if (Rank == NobilityRank.Duke)
                                {
                                    ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Duke in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values);
                                }
                                if (Rank == NobilityRank.Prince)
                                {
                                    ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Prince in Nobility Rank.", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values);
                                }
                                if (Rank == NobilityRank.King)
                                {
                                    ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " has become the new King/Queen in "+Database.rates.servername+"!", System.Drawing.Color.White, Message.Center), ServerBase.Kernel.GamePool.Values);
                                }
                                if (Rank == NobilityRank.Knight)
                                {
                                    ServerBase.Kernel.SendWorldMessage(new Message("Congratulation! " + client.Entity.Name + " Donation To Knight in Nobility Rank.", System.Drawing.Color.White, Message.TopLeft), ServerBase.Kernel.GamePool.Values);
                                }
                            }
                            else
                            {
                                if (previousPlace != Place)
                                {
                                    updateTheClient = true;
                                }
                            }
                            if (updateTheClient || client.Entity.UID == updateUID)
                            {
                                NobilityInfo update = new NobilityInfo(true);
                                update.Type = NobilityInfo.Icon;
                                update.dwParam = value.Key;
                                update.UpdateString(value.Value);
                                client.SendScreen(update, true);
                                client.Entity.NobilityRank = value.Value.Rank;
                            }
                        }
                        sortedBoard.Add(value.Key, value.Value);
                        Place++;
                    }
                    catch { }
                }

            }

            Board = sortedBoard;

            lock (BoardList)
            {
                BoardList = Board.Values.ToList();
            }
        }