|
|
? المشاركات 233 |
? +التقييم 0.14 |
?
تاريخ التسجيل Mar 2020 |
?
الاقامة https://www.facebook.com/Developer.Eng.Mayo |
?
نظام التشغيل |
?
رقم العضوية 3560 |
أفضل جواب - كتبه عادل عصام |
اتفضل دة البرنامج , https://www.mediafire.com/file/6pjym...yptor.rar/file طريقة الاستخدام اسحب ملف الايتم تايب جوة الايقونة بتاعتة هيطلعلك التكست عدل براحتك ولما تخلص اسحب التكست جواه هيطلعلك الايتم تايب ,
|
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 < 10)
{
Rank = NobilityRank.King;
if (Place < (10))
{
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
}
}
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 < 10)
{
rank = nobilityrank.king;
if (place < (10))
{
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) | |
أدوات الموضوع | |
|
الموضوع | كاتب الموضوع | المنتدى | مشاركات | آخر مشاركة |
خلي الكينج الاول اقوي من الثاني والثاني اقوي من الثالث وهكذا | محمد ياسر | تطوير سيرفرات كونكر | 5 | 2023-07-22 01:47 AM |
ازاى اعمل فرق بين اتاك الكينج و البرنس في سورس اليكس | Tofan | مشكلات السيرفيرات كونكر الشخصيه | 4 | 2020-04-19 03:00 PM |
عايز حل الايرور ده يا جماعه في سورس احمد فتحي | Tyranny-Team's | مشكلات السيرفيرات كونكر الشخصيه | 7 | 2020-03-28 07:10 AM |
طلب بعد اذنكو ممكن حرب كابتشر فلاج كامله | ابو مروان | مشكلات السيرفيرات كونكر الشخصيه | 2 | 2019-09-29 05:00 AM |
عايز اخلي الوار كل يوم | ElSaher | مشكلات السيرفيرات كونكر الشخصيه | 7 | 2019-07-25 03:15 AM |