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>(10000); 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 >= 50) { if (value.Value.Donation >= 200000000) { 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); //Rank = NobilityRank.Earl; } else if (value.Value.Donation >= 100000000) { 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); //Rank = NobilityRank.Baron; } else if (value.Value.Donation >= 30000000) { 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); //Rank = NobilityRank.Knight; } } else { if (Place < 3) { //Conquer_Online_Server.ServerBase.Kernel.SendWorldMessage(new Conquer_Online_Server.Network.GamePackets.Message("Congratulation! " + client.Entity.Name + "Donation To King in Nobility Rank!", System.Drawing.Color.White, 2011), Conquer_Online_Server.ServerBase.Kernel.GamePool.Values); Rank = NobilityRank.King; //Conquer_Online_Server.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 < 15) { Rank = NobilityRank.Prince; //Conquer_Online_Server.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; //Conquer_Online_Server.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; } 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(); } }
static void LoginMessages(Client.GameState client) { if (client.WentToComplete) return; // ServerBase.Kernel.Elite_PK_Tournament.LoginClient(client); if (client.Entity.MapID == 6002) ServerBase.Kernel.Elite_PK_Tournament.ObtinedOutCoord(client); //client.Account.State = Database.AccountTable.AccountState.Player; client.WentToComplete = true; client.Entity.SendUpdates = true; Data datas = new Data(true); datas.UID = client.Entity.UID; datas.ID = 116; datas.dwParam = 1197; client.Send(datas); if (client.Entity.VIPLevel > 0) { VIPAdvanced vp = new VIPAdvanced(true); vp.UID = 65535; client.Send(vp); } #region Game Updates client.Send(new GameUpdates(GameUpdates.Header, "Sharpness-Co Updates" + DateTime.Now.ToString())); //clients.Send(new GameUpdates(GameUpdates.Body, "")); client.Send(new GameUpdates(GameUpdates.Body, "All Events now Fixed")); client.Send(new GameUpdates(GameUpdates.Body, "1.Ping now is Now fixed enjoy")); client.Send(new GameUpdates(GameUpdates.Body, "2.Pirate 95% done still need reborn and skills")); client.Send(new GameUpdates(GameUpdates.Body, "3.Clan system now fixed ")); client.Send(new GameUpdates(GameUpdates.Body, "4.Attack now fixed")); client.Send(new GameUpdates(GameUpdates.Body, "5.MemoryAgate now works")); client.Send(new GameUpdates(GameUpdates.Body, "6.Refinery now works good")); client.Send(new GameUpdates(GameUpdates.Body, "7.DecreasePK NPC in TwinCity now can less your pk fast")); client.Send(new GameUpdates(GameUpdates.Body, "8.All characters can take +6 items from twin city")); client.Send(new GameUpdates(GameUpdates.Body, "9.Cheak every thing about Donation on game site ")); client.Send(new GameUpdates(GameUpdates.Body, "10.Only PM number 0115641487 for donate")); client.Send(new GameUpdates(GameUpdates.Footer, "There is only 2[PM] has [PM] of endes on his name dont trust any one else")); #endregion //#region SubClass ////client.Send(new SubClass(client.Entity).ToArray()); //SubClassShowFull sub = new SubClassShowFull(true); //sub.ID = 1; //sub.Level = client.Entity.SubClassLevel; //sub.Class = client.Entity.SubClass; //#region [Effects-Addition] //switch ((Conquer_Online_Server.Game.ClassID)client.Entity.SubClass) //{ // case Conquer_Online_Server.Game.ClassID.Apothecary: // { // // // client.Entity.Statistics.Detoxication = (ushort)(client.Entity.SubClasses.Classes[(byte)Conquer_Online_Server.Game.ClassID.Apothecary].Phase * 8); // //client.Entity.Statistics.Detoxication += (client.Entity.SubClasses.Classes[To].Level); // break; // } //} //#endregion //client.Send(sub); //#endregion if (client.Entity.Myclan != null) { Network.GamePackets.Clan cl = new Conquer_Online_Server.Network.GamePackets.Clan(client, 1); client.Send(cl.ToArray()); } foreach (var Guild in ServerBase.Kernel.Guilds.Values) { Guild.SendName(client); } if (client.Entity.ElitePK == 1) { client.Entity.TitleActivated = 14; Database.SubClassTable.Update56(client.Entity); Conquer_Online_Server.Database.EntityTable.SaveTop(client.Entity); } //foreach (Client.GameState clients in ServerBase.Kernel.GamePool.Values) //{ // clients.Entity.Owner.Send(new Conquer_Online_Server.Network.GamePackets.Message("Name= [" + client.Entity.Name + "] Level= [" + client.Entity.Level + "] Reborn= [" + client.Entity.Reborn + "] CPS= [" + client.Entity.ConquerPoints + "] VIPLevel= [" + client.Entity.VIPLevel + "] " + " Has Logged On and " + " Players online= [" + ServerBase.Kernel.GamePool.Count + "]", System.Drawing.Color.White, 2005)); //} if (client.Entity.AddFlower == 1) if (client.Entity.Body.ToString().EndsWith("3") || client.Entity.Body.ToString().EndsWith("4")) client.Send(new Network.GamePackets.FlowerPacket(new Game.Struct.Flowers()).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.Spouse = client.Entity.Spouse; if (client.Guild != null) { if (client.Entity.GuildRank == (ushort)Game.Enums.GuildMemberRank.DeputyLeader) { if (client.Guild.Name == Game.ConquerStructures.Society.GuildWar.Pole.Name) { client.Entity.AddFlag(Update.Flags.TopDeputyLeader); } } else if (client.Entity.GuildRank == (ushort)Game.Enums.GuildMemberRank.GuildLeader) { if (client.Guild.Name == Game.ConquerStructures.Society.GuildWar.Pole.Name) { client.Entity.AddFlag(Update.Flags.TopGuildLeader); } } } client.Entity.DoubleExperienceTimeV1 = (ushort)(client.Entity.DoubleExperienceTimeV1 + (1 - 1)); client.Entity.DoubleExperienceTime = (ushort)(client.Entity.DoubleExperienceTime + (1 - 1)); client.Entity.DoubleExperienceTime5 = (ushort)(client.Entity.DoubleExperienceTime5 + (1 - 1)); client.Entity.DoubleExperienceTime10 = (ushort)(client.Entity.DoubleExperienceTime10 + (1 - 1)); client.Entity.DoubleExperienceTime15 = (ushort)(client.Entity.DoubleExperienceTime15 + (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); client.Entity.Stamina = 100; //client.Send(new Message("Welcome to the Reborn of " + ServerBase.Constants.ServerName + "Conquer ! Same staff here", System.Drawing.Color.Red, Message.Talk)); //client.Send(new Message("All monster drop CpsBag! With random Cps! ", System.Drawing.Color.Red, Message.Talk)); //client.Send(new Message("If you need help! Use Service Chat", System.Drawing.Color.Red, Message.Talk)); //client.Send(new Message("GuildWar Start: Saturday Hour: 18", System.Drawing.Color.Red, Message.Talk)); //client.Send(new Message("GuildWar Finish: Sunday Hour: 10", System.Drawing.Color.Red, Message.Talk)); string[] wm = File.ReadAllLines(ServerBase.Constants.WelcomeMessages); foreach (string line in wm) { if (line.Length == 0) continue; if (line[0] == ';') continue; client.Send(new Message(line, System.Drawing.Color.Red, Message.Talk)); } //if (Database.VoteTable.CanVote(client)) //{ // client.OnMessageBoxOK = delegate // { // Network.GamePackets.Data data = new Network.GamePackets.Data(true); // data.UID = client.Entity.UID; // data.ID = Network.GamePackets.Data.OpenCustom; // data.dwParam = Network.GamePackets.Data.CustomCommands.Minimize; // client.Send(data); // client.Send(new Message(ServerBase.Constants.ServerWebsite + ServerBase.Constants.WebAccExt + ServerBase.Constants.WebVoteExt, System.Drawing.Color.Red, Network.GamePackets.Message.Website)); // }; // client.Send(new NpcReply(NpcReply.MessageBox, "Would you like to consider voting for us? With more votes we will be come a bigger community.")); //} /*if (client.Entity.VIPLevel != 0) { Database.PremiumTable.getVipInfo(client); if (client.VIPDays != 0) { if (DateTime.Now >= client.VIPDate.AddDays(client.VIPDays)) { client.Entity.VIPLevel = 0; client.Send(ServerBase.Constants.VIPExpired); } else { DateTime VipEnds = client.VIPDate.AddDays(client.VIPDays); TimeSpan span = VipEnds.Subtract(DateTime.Now); client.Send(ServerBase.Constants.VIPRemaining(span.Days.ToString(), span.Hours.ToString())); } } else client.Send(ServerBase.Constants.VIPLifetime); }*/ //if (Program.Today == DayOfWeek.Saturday || Program.Today == DayOfWeek.Sunday) // client.Send(new Message("Double experience is on.", System.Drawing.Color.Red, Message.World)); client.Send(new MapStatus() { BaseID = client.Map.BaseID, ID = client.Map.ID, Status = Database.MapsTable.MapInformations[client.Map.ID].Status }); if (client.Entity.Hitpoints == 0) client.Entity.Hitpoints = 1; client.Entity.VIPLevel = (byte)(client.Entity.VIPLevel + 0); client.Entity.HandleTiming = true; 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, 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); 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(item); } else { client.Equipment.DestroyArrow(item.Position); Console.WriteLine("Announcement: Item have been removed because of invalid info. UID: " + item.UID + ". OWNER: " + client.Entity.Name); } } if (!client.Equipment.Free(5)) { if (IsArrow(client.Equipment.TryGetItem(5).ID)) { if (client.Equipment.Free(4)) client.Equipment.DestroyArrow(5); else { if (client.Equipment.TryGetItem(4).ID / 1000 != 500) client.Equipment.DestroyArrow(5); } } } client.GemAlgorithm(); client.CalculateStatBonus(); client.CalculateHPBonus(); client.SendStatMessage(); // Conquer_Online_Server.Game.Attacking.Calculate.Vitals(client.Entity, true); client.Equipment.UpdateEntityPacket(); EntityEquipment equips = new EntityEquipment(true); equips.ParseHero(client); client.Send(equips); System.Threading.Thread.Sleep(3500); //if ((int)client.Account.State >= 3) // client.Entity.AddFlag(Update.Flags.Flashy); }