المساعد الشخصي الرقمي

مشاهدة النسخة كاملة : التعديل علي عدد الكنجات والدونيشن


انت عمري
2019-10-03, 03:30 PM
السلام عليكم


لو سمحت انا شغال بسورس msg
عايز اخلي الدونيشن طبيعية زي كونكر اونلاين

انا مش عارف العدد بس الى فكره ان الكنج 3
المهم دة ملف بتاع الدونيشن عندي ممكن حد يظبطهولي زي كونكر اونلاين يظبطلي عدد الكنجات والبرنسات والدك



Nobility.cs



using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using Project_Terror_v2.Game.MsgServer;

namespace Project_Terror_v2.Role.Instance
{
public class Nobility
{
public class NobilityRanking
{
public ulong KnightDonation = 30000000, BaronDonation = 100000000, EarlDonation = 200000000;
public ulong DukeDonation;
public ulong PrinceDonation;
public ulong KingDonation;

private Dictionary<uint, Nobility> ClientPoll;

public NobilityRanking()
{
ClientPoll = new Dictionary<uint, Nobility>();
}
public bool TryGetValue(uint UID, out Nobility user)
{
return ClientPoll.TryGetValue(UID, out user);
}
public Nobility[] GetArray()
{
return ClientPoll.Values.ToArray();
}
public void UpdateRank(Nobility user)
{
if (ClientPoll.Count < 50)
CreateRank(user);
else
{
var array = ClientPoll.Values.ToArray();
if (array[49].Donation < user.Donation)
CreateRank(user);
else if (ClientPoll.ContainsKey(user.UID))
CreateRank(user);
}
}
internal void CreateRank(Nobility user)
{
lock (ClientPoll)
{
using (var rec = new ServerSockets.RecycledPacket())
{
var stream = rec.GetStream();
if (!ClientPoll.ContainsKey(user.UID))
ClientPoll.Add(user.UID, user);
var Array = ClientPoll.Values.Where(p => p.Donation > 200000000).ToArray();
var Order = Array.OrderByDescending(p => p.Donation).ToArray();
ClientPoll.Clear();

for (int x = 0; x < Order.Length; x++)
{
var nobilityclient = Order[x];
int OldPosition = nobilityclient.Position;
var OldRank = nobilityclient.Rank;
if (x < 50)
{
nobilityclient.Position = x;
ClientPoll.Add(nobilityclient.UID, nobilityclient);
if (x == 2)
KingDonation = nobilityclient.Donation;
else if (x == 14)
PrinceDonation = nobilityclient.Donation;
else if (x == 49)
DukeDonation = nobilityclient.Donation;
}
else
nobilityclient.Position = -1;

if (OldPosition != nobilityclient.Position)
{

UpdateClientIcon(stream,nobilityclient);
if (nobilityclient.Rank > OldRank)
{
if (Program.SendGlobalPackets != null)
{
#if Arabic
Program.SendGlobalPackets.Enqueue(new Game.MsgServer.MsgMessage(nobilityclient.Name + " has been promoted to " + nobilityclient.Rank.ToString() + ".", "ALL", Game.MsgServer.MsgMessage.MsgColor.red, Game.MsgServer.MsgMessage.ChatMode.Center).GetArra y(stream));

#else
Program.SendGlobalPackets.Enqueue(new Game.MsgServer.MsgMessage(nobilityclient.Name + " has been promoted to " + nobilityclient.Rank.ToString() + ".", "ALL", Game.MsgServer.MsgMessage.MsgColor.red, Game.MsgServer.MsgMessage.ChatMode.Center).GetArra y(stream));

#endif
}
//Program.SendGlobalPackets.Enqueue(new Game.MsgServer.MsgMessage("Congratulation! " + nobilityclient.Name + " donated to " + nobilityclient.Rank.ToString() + " in Nobility Rank.", "ALL", Game.MsgServer.MsgMessage.MsgColor.red, Game.MsgServer.MsgMessage.ChatMode.Center).GetArra y(stream));
}
}
}
}
}
}
internal unsafe void UpdateClientIcon(ServerSockets.Packet stream, Nobility user)
{
Client.GameClient client;
if (Database.Server.GamePoll.TryGetValue(user.UID, out client))
{
client.Player.NobilityRank = user.Rank;
client.Send(stream.NobilityIconCreate(user));
}
}
}
public enum NobilityRank : byte
{
Serf = 0,
Knight = 1,
Baron = 3,
Earl = 5,
Duke = 7,
Prince = 9,
King = 12
}


public uint UID;
public string Name;
public int Position = -1;
public ulong Donation;
public uint Mesh;
public byte Gender;
public NobilityRank Rank
{
get
{
#if Encore
if (Position >= 0 && Position < 3)
return NobilityRank.King;
else if (Position >= 3 && Position < 15)
return NobilityRank.Prince;
#else
if (Position >= 0 && Position < 6)
return NobilityRank.King;
else if (Position >= 6 && Position < 20)
return NobilityRank.Prince;
#endif
else if (Position >= 20 && Position < 50)
return NobilityRank.Duke;

if (Donation >= 200000000)
return NobilityRank.Earl;
else if (Donation >= 100000000)
return NobilityRank.Baron;
else if (Donation >= 30000000)
return NobilityRank.Knight;

return NobilityRank.Serf;
}
}
public Nobility(uint _uid, string _name, ulong _donation, uint _mesh, byte _gender)
{
UID = _uid;
Name = _name;
Donation = _donation;
Mesh = _mesh;
Gender = _gender;
}
public Nobility(Client.GameClient user)
{
UID = user.Player.UID;
Name = user.Player.Name;
Mesh = user.Player.Mesh;
Gender = user.Player.GetGender;
}
}
}

ElSaher
2019-10-03, 03:53 PM
من دا

Serf = 0,
Knight = 1,
Baron = 3,
Earl = 5,
Duke = 7,
Prince = 9,
King = 12

انت عمري
2019-10-03, 03:54 PM
من دا

serf = 0,
knight = 1,
baron = 3,
earl = 5,
duke = 7,
prince = 9,
king = 12
طيب عايز افهم الطبعيني كام كنج وكام دك وكام برنس

Hassan Emprator
2019-10-03, 04:02 PM
طيب عايز افهم الطبعيني كام كنج وكام دك وكام برنس

حضرتك ل وعايز تعرف عندك في الاكواد دي

--------------------------------------------------------------------------------
من دا

Serf = 0,
Knight = 1,
Baron = 3,
Earl = 5,
Duke = 7,
Prince = 9,
King = 12

عندك الكنج عندك 12 كنج
في اللعبه وعندك 9
برنس
وعندك 5 ايرل وعندك 7 دوق

فهمتني :)

ElSaher
2019-10-03, 04:04 PM
منا بعتلو الحل فوق يا حسن هوا فهم

انت عمري
2019-10-03, 04:12 PM
منا بعتلو الحل فوق يا حسن هوا فهم
ايوة انا فهمت بس المشكلة دلوقتي اني مش عارف ارتبهم زي كونكر اونلاين

يعني اعمل 3 كنج طيب البرنس كام واحد والدوك كام واحد فهمتوني ؟

Hassan Emprator
2019-10-03, 04:13 PM
اها انت تخش كونكر اون لاين وتشوف البرنسات كام ببقا تفضل تعد وتشوف فهمتني ؟