|
المشاركات 539 |
+التقييم 0.27 |
تاريخ التسجيل May 2019 |
الاقامة |
نظام التشغيل |
رقم العضوية 188 |
if (client.Player.Money >= silvers)
{
client.Player.Money -= (uint)silvers;
client.NobilityInformation.Donation += silvers;
}
using System;
using System.Linq;
using System.Collections.Generic;
using Mr_Panda.Network.GamePackets;
using System.IO;
namespace Mr_Panda.Game.ConquerStructures
{
public class Nobility : Mr_Panda.Network.Writer
{
public static ulong MaxDonation = 0;
public static ulong MaxDonation1 = 0;
public static ulong MaxDonation2 = 0;
public static SafeDictionary<uint, NobilityInformation> Board = new SafeDictionary<uint, NobilityInformation>(10000);
public static List<NobilityInformation> BoardList = new List<NobilityInformation>(10000);
public static void Handle(NobilityInfo information, Client.GameState client)
{
if (information.Type == NobilityInfo.Donate)
return;
switch (information.Type)
{
case NobilityInfo.Donate:
{
if (client.Trade.InTrade)
return;
if (client.Player.DonateTime)
return;
ulong silvers = information.dwParam;
bool newDonator = false;
client.NobilityInformation.Gender = (byte)(client.Player.Body % 10);
if (client.NobilityInformation.Donation == 0)
newDonator = true;
if (information.MoneyType == 1)
{
ulong cps = silvers / 50000;
if (client.Player.ConquerPoints >= 10000)
{
client.Player.ConquerPoints -= 10000;
client.NobilityInformation.Donation += silvers;
}
}
else
{
if (client.Player.Money >= silvers)
{
client.Player.Money -= (uint)silvers;
client.NobilityInformation.Donation += silvers;
}
}
if (!Board.ContainsKey(client.Player.UID) && client.NobilityInformation.Donation == silvers && newDonator)
{
Board.Add(client.Player.UID, client.NobilityInformation);
try
{
Database.NobilityTable.InsertNobilityInformation(client.NobilityInformation);
}
catch
{
Database.NobilityTable.UpdateNobilityInformation(client.NobilityInformation);
}
}
else
{
Database.NobilityTable.UpdateNobilityInformation(client.NobilityInformation);
}
Sort(client.Player.UID);
break;
}
case NobilityInfo.List:
{
byte[] packet = new byte[600 + 8];
Network.Writer.WriteUInt16(600, 0, packet);
Network.Writer.WriteUInt16(2064, 2, packet);
Network.Writer.WriteUInt16(2, 4, packet);
Network.Writer.WriteUInt16(5, 10, packet);
Network.Writer.WriteUInt16(20, 12, packet);
int offset = 120;
for (int i = (int)(information.wParam1 * 10); i < information.wParam1 * 10 + 10 && i < BoardList.Count; i++)
{
var nob = BoardList[i];
Network.Writer.WriteUInt32(nob.EntityUID, offset, packet);
offset += 4;
if (Kernel.GamePool.ContainsKey(nob.EntityUID))
{
Network.Writer.WriteUInt32(1, offset, packet);
offset += 4;
Network.Writer.WriteUInt32(nob.Mesh, offset, packet);
offset += 4;
}
else
{
offset += 8;
}
Network.Writer.WriteString(nob.Name, offset, packet);
offset += 20;
Network.Writer.WriteUInt64(nob.Donation, offset, packet);
offset += 8;
Network.Writer.WriteUInt32((uint)nob.Rank, offset, packet);
offset += 4;
Network.Writer.WriteUInt32((uint)i, offset, packet);
offset += 4;
}
client.Send(packet);
break;
}
}
}
public static void Donate(ulong silvers, Client.GameState client, bool Npc = false)
{
if (Npc == false)
return;
bool newDonator = false;
client.NobilityInformation.Gender = (byte)(client.Player.Body % 10);
if (client.NobilityInformation.Donation == 0)
newDonator = true;
client.NobilityInformation.Donation += silvers;
if (!Board.ContainsKey(client.Player.UID) && client.NobilityInformation.Donation == silvers && newDonator)
{
Board.Add(client.Player.UID, client.NobilityInformation);
try
{
Database.NobilityTable.InsertNobilityInformation(client.NobilityInformation);
}
catch
{
Database.NobilityTable.UpdateNobilityInformation(client.NobilityInformation);
}
}
else
{
Database.NobilityTable.UpdateNobilityInformation(client.NobilityInformation);
}
Sort(client.Player.UID);
}
public static void Sort(uint updateUID)
{
SafeDictionary<uint, NobilityInformation> sortedBoard = new SafeDictionary<uint, NobilityInformation>();
int Place = 0;
foreach (NobilityInformation entry in Board.Values.OrderByDescending((p) => p.Donation))
{
Client.GameState client = null;
try
{
int previousPlace = entry.Position;
entry.Position = Place;
NobilityRank Rank = NobilityRank.Serf;
if (Place >= 10000)
{
if (entry.Donation >= 200000)
{
Rank = NobilityRank.Earl;
}
else if (entry.Donation >= 100000)
{
Rank = NobilityRank.Baron;
}
else if (entry.Donation >= 300000)
{
Rank = NobilityRank.Knight;
}
}
else
{
if (Place < 99999999)
{
Rank = NobilityRank.King;
if (Place < (99999999))
{
MaxDonation = entry.Donation;
}
}
else if (Place < 20)
{
Rank = NobilityRank.Prince;
if (Place < 20)
{
MaxDonation1 = entry.Donation;
}
}
else
{
if (Place < 9999)
{
}
Rank = NobilityRank.Duke;
if (Place < (9999))
{
MaxDonation2 = entry.Donation;
}
}
}
var oldRank = entry.Rank;
entry.Rank = Rank;
if (Kernel.GamePool.TryGetValue(entry.EntityUID, out client))
{
bool updateTheClient = false;
if (oldRank != Rank)
{
updateTheClient = true;
if (Rank == NobilityRank.Baron)
{
Kernel.SendWorldMessage(new Message(" Congratulation " + client.Player.Name + " has the Baron In Pharaohs-Eu ", System.Drawing.Color.White, Message.TopLeft), Program.Values);
}
if (Rank == NobilityRank.Earl)
{
Kernel.SendWorldMessage(new Message(" Congratulation " + client.Player.Name + " has the Earl In Pharaohs-Eu ", System.Drawing.Color.White, Message.TopLeft), Program.Values);
}
if (Rank == NobilityRank.Duke)
{
Kernel.SendWorldMessage(new Message(" Congratulation " + client.Player.Name + " has the Duke In Pharaohs-Eu ", System.Drawing.Color.White, Message.Center), Program.Values);
}
if (Rank == NobilityRank.Prince)
{
Kernel.SendWorldMessage(new Message(" Congratulation " + client.Player.Name + " has the Prince In Pharaohs-Eu ", System.Drawing.Color.White, Message.Center), Program.Values);
}
if (Rank == NobilityRank.King)
{
Kernel.SendWorldMessage(new Message(" Congratulation " + client.Player.Name + " has become the new King/Queen In Pharaohs-Eu ", System.Drawing.Color.White, Message.Center), Program.Values);
}
if (Rank == NobilityRank.Knight)
{
Kernel.SendWorldMessage(new Message(" Congratulation " + client.Player.Name + " has become a Knight By In Pharaohs-Eu ", System.Drawing.Color.White, Message.TopLeft), Program.Values);
}
}
else
{
if (previousPlace != Place)
{
updateTheClient = true;
}
}
if (updateTheClient || client.Player.UID == updateUID)
{
NobilityInfo update = new NobilityInfo(true);
update.Type = NobilityInfo.Icon;
update.dwParam = entry.EntityUID;
update.UpdateString(entry);
client.SendScreen(update, true);
client.Player.NobilityRank = entry.Rank;
}
}
sortedBoard.Add(entry.EntityUID, entry);
Place++;
}
catch { }
}
Board = sortedBoard;
lock (BoardList)
BoardList = Board.Values.ToList();
}
}
public class NobilityInformation
{
public string Name;
public uint EntityUID;
public uint Mesh;
public ulong Donation;
public byte Gender;
public int Position;
public NobilityRank Rank;
public bool king;
public DateTime KingDays;
}
public enum NobilityRank : byte
{
Serf = 0,
Knight = 1,
Baron = 3,
Earl = 5,
Duke = 7,
Prince = 9,
King = 12
}
}
الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1) | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
لو تكرمتم اى شخص عندى ف الجيم بيفتح الرانك الاكونت يهنج | megokarika | مشكلات السيرفيرات كونكر الشخصيه | 6 | 2020-02-20 02:58 PM |
مشكلة غريبه جدآ الاسطفا بتظهر من غير ال hp وي الدمج 7 الحل ايه يا رجاله | ahmedfathy | مشكلات السيرفيرات كونكر الشخصيه | 1 | 2019-11-30 03:51 PM |
حل يا رجاله | abdo01120248447 | مشكلات السيرفيرات كونكر الشخصيه | 3 | 2019-10-24 11:47 AM |
حل مشكلة بسرعه يا رجاله | ElSaher | مشكلات السيرفيرات كونكر الشخصيه | 2 | 2019-09-16 09:35 AM |
حل مشكلة الرانك | osama | مشكلات السيرفيرات كونكر الشخصيه | 19 | 2019-07-21 01:41 PM |