public static void DonateCPs(Entities.GameClient client, long Amount) { uint cps = (uint)(Amount / 50000); if (client.CPs < cps) { return; } if (Amount < 3000000) { return; } if (Amount > 999999999) { return; } if (Donations.ContainsKey(client.DatabaseUID)) { NobilityDonation donation; if (Donations.TryGetValue(client.DatabaseUID, out donation)) { if (donation.Donation >= Core.NumericConst.MaxNobilityDonation) { return; } client.CPs -= cps; donation.Donation = Math.Min(Core.NumericConst.MaxNobilityDonation, (long)(donation.Donation + Amount)); GetTop50(); client.SendNobility(); donation.UpdateDonation(); } } else { client.CPs -= cps; NobilityDonation donation = new NobilityDonation(); donation.Rank = Enums.NobilityRank.Serf; donation.Donation = Amount; if (Donations.TryAdd(client.DatabaseUID, donation)) { donation.DatabaseID = client.DatabaseUID; donation.Name = client.Name; donation.Client = client; client.Nobility = donation; GetTop50(); client.SendNobility(); donation.CreateDatabase(); donation.UpdateDonation(); } } }
public static void Handle(Entities.GameClient client) { // Send vip, merchant, quiz points and heavenbless etc. client.BaseEntity.SetBaseStats(); client.BaseEntity.CalculateBaseStats(); client.Stamina = 50; client.PKPoints = client.PKPoints; // update status effect client.BoundCPs = client.BoundCPs; // for some reason this has to be done here ... using (ProjectX_V3_Lib.Sql.SqlHandler sql = Database.CharacterDatabase.OpenRead(client, "DB_Players")) client.StatusFlag2 = sql.ReadUInt64("PlayerStatusFlag"); Console.ForegroundColor = ConsoleColor.Green; Console.WriteLine(Core.MessageConst.LOGIN_MSG, client.Name, client.Account, client.EntityUID, client.DatabaseUID); Console.ResetColor(); MessagePacket bc = Threads.BroadcastThread.GetLastBroadcast(); if (bc != null) { client.Send(bc); bc.Dispose(); } Database.CharacterDatabase.LoadMessageQuery(client); Data.NobilityBoard.SetNobility(client); client.SendNobility(); client.SendSubClasses2(); Packets.UpdatePacket update = Packets.UpdatePacket.Create(client.EntityUID); update.AddUpdate(Enums.UpdateType.VIPLevel, 6); update.AddUpdate(Enums.UpdateType.Merchant, 255); client.Send(update); Data.ArenaQualifier.SetArenaInfo(client); if (client.Arena == null) { client.Arena = new ProjectX_V3_Game.Data.ArenaInfo(client); client.Arena.ArenaHonorPoints = 1000; client.Arena.Level = (uint)client.Level; client.Arena.Class = (uint)client.Class; Database.ArenaDatabase.AddNewArenaInfo(client.Arena); if (!Data.ArenaQualifier.AddArenaInfo(client.Arena)) { client.NetworkClient.Disconnect("FAILED_TO_MAKE_ARENA_INFO"); return; } } client.CanSave = true; using (var motd = Packets.Message.MessageCore.CreateTalk( Core.SystemVariables.Variables["ServerName"], client.Name, Core.SystemVariables.ReplaceVariables(Program.Config.ReadString("MOTD")))) client.Send(motd); }