قديم 2019-09-15, 09:49 PM
المشاركة 2
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: الاكونت اول مابينزل بيكون Earl من غير مايكون دافع حاجة فى الدونيشن
Nobility.cs
سيرش

كود:
public static void Sort

اقفله من سالب و حط ده مكانه

كود:
 public static void Sort(uint updateUID)
        {
            
SafeDictionary<uintNobilityInformationsortedBoard = new SafeDictionary<uintNobilityInformation>();

            
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 >= 50)
                    {
                        if (
entry.Donation == 1)
                        {
                            
Rank NobilityRank.King;
                        }
                        else
                        {
                            if (
entry.Donation >= 200000000)
                            {
                                
Rank NobilityRank.Earl;
                            }
                            else if (
entry.Donation >= 100000000)
                            {
                                
Rank NobilityRank.Baron;
                            }
                            else if (
entry.Donation >= 30000000)
                            {
                                
Rank NobilityRank.Knight;
                            }
                            else 
                            {
                                
Rank NobilityRank.Serf;
                            }
                        }

                    }
                    else
                    {
                        if (
entry.Donation == 1)
                        {
                            
Rank NobilityRank.King;
                        }
                        else
                        {
                            if (
Place 2)//serverrank 
                            
{
                                
Rank NobilityRank.King;
                            }
                            else if (
Place 24)
                            {
                                
Rank NobilityRank.Prince;
                            }
                            else
                            {
                                
Rank NobilityRank.Duke;
                            }
                        }
                    }
                    var 
oldRank entry.Rank;
                    
entry.Rank Rank;
                    if (
Kernel.GamePool.TryGetValue(entry.EntityUIDout client))
                    {
                        
bool updateTheClient false;
                        if (
oldRank != Rank)
                        {
                            
updateTheClient true;

                            if (
Rank == NobilityRank.Duke)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Entity.Name " has the Duke title in Frozen||Hell."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.Prince)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Entity.Name " has the Prince title in Frozen||Hell."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.King)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Entity.Name " has become the new King/Queen in Frozen||Hell."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }

                        }
                        else
                        {
                            if (
previousPlace != Place)
                            {
                                
updateTheClient true;
                            }
                        }
                        if (
updateTheClient || client.Entity.UID == updateUID)
                        {
                            
NobilityInfo update = new NobilityInfo(true);
                            
update.Type NobilityInfo.Icon;
                            
update.dwParam entry.EntityUID;
                            
update.UpdateString(entry);
                            
client.SendScreen(updatetrue);
                            
client.Entity.NobilityRank entry.Rank;
                        }
                    }
                    
sortedBoard.Add(entry.EntityUIDentry);
                    
Place++;
                }
                catch { }
            }
            
Board sortedBoard;
            
lock (BoardList)
                
BoardList Board.Values.ToList();
        } 


قديم 2019-09-15, 09:50 PM
المشاركة 3
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: الاكونت اول مابينزل بيكون Earl من غير مايكون دافع حاجة فى الدونيشن
Nobility.cs
سيرش

كود:
public static void Sort

اقفله من سالب و حط ده مكانه

كود:
 public static void Sort(uint updateUID)
        {
            
SafeDictionary<uintNobilityInformationsortedBoard = new SafeDictionary<uintNobilityInformation>();

            
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 >= 50)
                    {
                        if (
entry.Donation == 1)
                        {
                            
Rank NobilityRank.King;
                        }
                        else
                        {
                            if (
entry.Donation >= 200000000)
                            {
                                
Rank NobilityRank.Earl;
                            }
                            else if (
entry.Donation >= 100000000)
                            {
                                
Rank NobilityRank.Baron;
                            }
                            else if (
entry.Donation >= 30000000)
                            {
                                
Rank NobilityRank.Knight;
                            }
                            else 
                            {
                                
Rank NobilityRank.Serf;
                            }
                        }

                    }
                    else
                    {
                        if (
entry.Donation == 1)
                        {
                            
Rank NobilityRank.King;
                        }
                        else
                        {
                            if (
Place 2)//serverrank 
                            
{
                                
Rank NobilityRank.King;
                            }
                            else if (
Place 24)
                            {
                                
Rank NobilityRank.Prince;
                            }
                            else
                            {
                                
Rank NobilityRank.Duke;
                            }
                        }
                    }
                    var 
oldRank entry.Rank;
                    
entry.Rank Rank;
                    if (
Kernel.GamePool.TryGetValue(entry.EntityUIDout client))
                    {
                        
bool updateTheClient false;
                        if (
oldRank != Rank)
                        {
                            
updateTheClient true;

                            if (
Rank == NobilityRank.Duke)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Entity.Name " has the Duke title in Frozen||Hell."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.Prince)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Entity.Name " has the Prince title in Frozen||Hell."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.King)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Entity.Name " has become the new King/Queen in Frozen||Hell."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }

                        }
                        else
                        {
                            if (
previousPlace != Place)
                            {
                                
updateTheClient true;
                            }
                        }
                        if (
updateTheClient || client.Entity.UID == updateUID)
                        {
                            
NobilityInfo update = new NobilityInfo(true);
                            
update.Type NobilityInfo.Icon;
                            
update.dwParam entry.EntityUID;
                            
update.UpdateString(entry);
                            
client.SendScreen(updatetrue);
                            
client.Entity.NobilityRank entry.Rank;
                        }
                    }
                    
sortedBoard.Add(entry.EntityUIDentry);
                    
Place++;
                }
                catch { }
            }
            
Board sortedBoard;
            
lock (BoardList)
                
BoardList Board.Values.ToList();
        } 


قديم 2019-09-16, 12:02 AM
المشاركة 4
ViORX
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: الاكونت اول مابينزل بيكون Earl من غير مايكون دافع حاجة فى الدونيشن
Nobility.cs
سيرش

كود:
public static void Sort

اقفله من سالب و حط ده مكانه

كود:
 public static void Sort(uint updateUID)
        {
            
SafeDictionary<uintNobilityInformationsortedBoard = new SafeDictionary<uintNobilityInformation>();

            
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 >= 50)
                    {
                        if (
entry.Donation == 1)
                        {
                            
Rank NobilityRank.King;
                        }
                        else
                        {
                            if (
entry.Donation >= 200000000)
                            {
                                
Rank NobilityRank.Earl;
                            }
                            else if (
entry.Donation >= 100000000)
                            {
                                
Rank NobilityRank.Baron;
                            }
                            else if (
entry.Donation >= 30000000)
                            {
                                
Rank NobilityRank.Knight;
                            }
                            else 
                            {
                                
Rank NobilityRank.Serf;
                            }
                        }

                    }
                    else
                    {
                        if (
entry.Donation == 1)
                        {
                            
Rank NobilityRank.King;
                        }
                        else
                        {
                            if (
Place 2)//serverrank 
                            
{
                                
Rank NobilityRank.King;
                            }
                            else if (
Place 24)
                            {
                                
Rank NobilityRank.Prince;
                            }
                            else
                            {
                                
Rank NobilityRank.Duke;
                            }
                        }
                    }
                    var 
oldRank entry.Rank;
                    
entry.Rank Rank;
                    if (
Kernel.GamePool.TryGetValue(entry.EntityUIDout client))
                    {
                        
bool updateTheClient false;
                        if (
oldRank != Rank)
                        {
                            
updateTheClient true;

                            if (
Rank == NobilityRank.Duke)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Entity.Name " has the Duke title in Frozen||Hell."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.Prince)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Entity.Name " has the Prince title in Frozen||Hell."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.King)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Entity.Name " has become the new King/Queen in Frozen||Hell."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }

                        }
                        else
                        {
                            if (
previousPlace != Place)
                            {
                                
updateTheClient true;
                            }
                        }
                        if (
updateTheClient || client.Entity.UID == updateUID)
                        {
                            
NobilityInfo update = new NobilityInfo(true);
                            
update.Type NobilityInfo.Icon;
                            
update.dwParam entry.EntityUID;
                            
update.UpdateString(entry);
                            
client.SendScreen(updatetrue);
                            
client.Entity.NobilityRank entry.Rank;
                        }
                    }
                    
sortedBoard.Add(entry.EntityUIDentry);
                    
Place++;
                }
                catch { }
            }
            
Board sortedBoard;
            
lock (BoardList)
                
BoardList Board.Values.ToList();
        } 

مش لاقى حاجة عندى خالص فى الملف من الاكواد اللى المفروض ابحث عنها وجبتلك اكواد ملف Nobility.cs اللى عندى بالكامل

using System;
using System.IO;
using System.Linq;
using Viorx.Client;
using System.Collections.Generic;
using Viorx.Network.GamePackets;

namespace Viorx.Game.ConquerStructures
{
public class Nobility : Network.Writer
{
public static SafeDictionary<uint, NobilityInformation> Board = new SafeDictionary<uint, NobilityInformation>(10000);
public static void Handle(NobilityInfo information, Client.GameState client)
{
switch (information.Type)
{
case NobilityInfo.Donate:
{
if (client.Trade.InTrade)
return;
if (client.Entity.PokerHack == true)
return;
ulong silvers = information.dwParam;
bool newDonator = false;
client.NobilityInformation.Gender = (byte)(client.Entity.Body % 10);
if (client.NobilityInformation.Donation == 0)
newDonator = true;
if (information.MoneyType == 1)
{
ulong cps = silvers / 1;
if (client.Entity.ConquerPoints >= cps)
{
client.Entity.ConquerPoints -= (uint)cps;
client.NobilityInformation.Donation += silvers;
}
}
else
{
if (client.Entity.Money >= silvers)
{
client.Entity.Money -= (ulong)silvers;
client.NobilityInformation.Donation += silvers;
}
}

if (!Board.ContainsKey(client.Entity.UID) && client.NobilityInformation.Donation == silvers && newDonator)
{
Board.Add(client.Entity.UID, client.NobilityInformation);
try
{
Database.NobilityTable.InsertNobilityInformation(c lient.NobilityInformation);
}
catch
{
Database.NobilityTable.UpdateNobilityInformation(c lient.NobilityInformation);
}
}
else
{
Database.NobilityTable.UpdateNobilityInformation(c lient.NobilityInformation);
}
Sort(client.Entity.UID);
break;
}
case NobilityInfo.List:
{
byte[] packet = new byte[608];
WriteUInt16((ushort)(packet.Length - 8), 0, packet);
WriteUInt16(2064, 2, packet);
WriteUInt16(2, 4, packet);
WriteUInt16((ushort)(Board.Count > 50 ? 5 : (Board.Count / 10) + 1), 10, packet);
int offset = 120;
ushort rank = 0;
rank = (ushort)(information.wParam1 * 10);
foreach (var entity in Board.Values.OrderByDescending(e => e.Donation).Skip(information.wParam1 * 10).Take(10))
{
WriteUInt32(entity.EntityUID, offset, packet);
offset += 4;
WriteUInt32(1, offset, packet);
offset += 4;
WriteUInt32(entity.Mesh, offset, packet);
offset += 4;
WriteString(entity.Name, offset, packet);
offset += 20;
WriteUInt64(entity.Donation, offset, packet);
offset += 8;
entity.Rank = getMyRank(entity.Donation, rank);
WriteUInt32((uint)entity.Rank, offset, packet);
offset += 4;
WriteUInt32((uint)rank, offset, packet);
offset += 4;
rank++;
}
WriteUInt16(rank, 12, packet);
client.Send(packet);
break;
}
}
}

private static void Sort(uint p)
{
throw new NotImplementedException();
}
private static NobilityRank getMyRank(ulong donation, int currentRank)
{
if (currentRank >= 0 && currentRank < 999999)
{
return NobilityRank.King;
}
else if (currentRank >= 10 && currentRank < 0)
{
return NobilityRank.Prince;
}
else if (currentRank >= 50 && currentRank < 0)
{
return NobilityRank.Duke;
}
else
{
return NobilityRank.Earl;
}
}
public static void Donate(ulong silvers, Client.GameState client)
{
bool newDonator = false;
client.NobilityInformation.Gender = (byte)(client.Entity.Body % 10);
if (client.NobilityInformation.Donation == 0) newDonator = true;
client.NobilityInformation.Donation += silvers;
int oldpos = client.NobilityInformation.Position;
if (!Board.ContainsKey(client.Entity.UID) && client.NobilityInformation.Donation == silvers && newDonator)
{
Board.Add(client.Entity.UID, client.NobilityInformation);
try
{
Database.NobilityTable.InsertNobilityInformation(c lient.NobilityInformation);
}
catch
{
Database.NobilityTable.UpdateNobilityInformation(c lient.NobilityInformation);
}
}
else
{
Database.NobilityTable.UpdateNobilityInformation(c lient.NobilityInformation);
}
updateOthers(oldpos, client);
}
private static void updateOthers(int oldPosition, GameState client)
{
int newpos = getPosition(client.Entity.UID);
var Rank = getMyRank(client.NobilityInformation.Donation, newpos);

if (oldPosition != newpos)
{
if (Rank == NobilityRank.King || Rank == NobilityRank.Prince || Rank == NobilityRank.Duke)
foreach (var p in Board.Values.OrderByDescending(e => e.Donation).Skip(newpos).Take(50 - newpos))
{
GameState cl = null;
if (Kernel.GamePool.TryGetValue(p.EntityUID, out cl))
SendIconToClient(cl);
}
}
SendIconToClient(client);
}
private static int getPosition(uint entityuid)
{
int currentPos = -1, post = -1;
if (Board.ContainsKey(entityuid))
{
foreach (var p in Board.Values.OrderByDescending(e => e.Donation))
{
currentPos++;
if (entityuid == p.EntityUID)
{
post = currentPos;
break;
}
}
}
return post;
}
public static void SendIconToClient(Client.GameState client)
{
if (client != null && client.NobilityInformation != null)
{
int pos = getPosition(client.Entity.UID);
client.Entity.NobilityRank = client.NobilityInformation.Rank = getMyRank(client.NobilityInformation.Donation, pos);
NobilityInfo update = new NobilityInfo(true);
update.Type = NobilityInfo.Icon;
update.dwParam = client.Entity.UID;
client.NobilityInformation.Position = pos;
update.UpdateString(client.NobilityInformation);
client.SendScreen(update, true);
}
}
}
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 enum NobilityRank : byte
{
Serf = 0,
Knight = 1,
Baron = 3,
Earl = 5,
Duke = 7,
Prince = 9,
King = 12,
}
}

قديم 2019-09-16, 02:26 AM
المشاركة 5
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: الاكونت اول مابينزل بيكون Earl من غير مايكون دافع حاجة فى الدونيشن

كود:
using System;
using System.IO;
using System.Linq;
using Viorx.Client;
using System.Collections.Generic;
using Viorx.Network.GamePackets;

namespace 
Viorx.Game.ConquerStructures
{
    public class 
Nobility Network.Writer
    
{
        public static 
SafeDictionary<uintNobilityInformationBoard = new SafeDictionary<uintNobilityInformation>(10000);
        public static 
void Handle(NobilityInfo informationClient.GameState client)
{
switch (
information.Type)
{
case 
NobilityInfo.Donate:
{
if (
client.Trade.InTrade)
return;
if (
client.Entity.PokerHack == true)
return;
ulong silvers information.dwParam;
bool newDonator false;
client.NobilityInformation.Gender = (byte)(client.Entity.Body 10);
if (
client.NobilityInformation.Donation == 0)
newDonator true;
if (
information.MoneyType == 1)
{
ulong cps silvers 1;
if (
client.Entity.ConquerPoints >= cps)
{
client.Entity.ConquerPoints -= (uint)cps;
client.NobilityInformation.Donation += silvers;
}
}
else
{
if (
client.Entity.Money >= silvers)
{
client.Entity.Money -= (ulong)silvers;
client.NobilityInformation.Donation += silvers;
}
}

if (!
Board.ContainsKey(client.Entity.UID) && client.NobilityInformation.Donation == silvers && newDonator)
{
Board.Add(client.Entity.UIDclient.NobilityInformation);
try
{
Database.NobilityTable.InsertNobilityInformation(c lient.NobilityInformation);
}
catch
{
Database.NobilityTable.UpdateNobilityInformation(c lient.NobilityInformation);
}
}
else
{
Database.NobilityTable.UpdateNobilityInformation(c lient.NobilityInformation);
}
Sort(client.Entity.UID);
break;
}
case 
NobilityInfo.List:
{
byte[] packet = new byte[608];
WriteUInt16((ushort)(packet.Length 8), 0packet);
WriteUInt16(20642packet);
WriteUInt16(24packet);
WriteUInt16((ushort)(Board.Count 50 : (Board.Count 10) + 1), 10packet);
int offset 120;
ushort rank 0;
rank = (ushort)(information.wParam1 10);
foreach (var 
entity in Board.Values.OrderByDescending(=> e.Donation).Skip(information.wParam1 10).Take(10))
{
WriteUInt32(entity.EntityUIDoffsetpacket);
offset += 4;
WriteUInt32(1offsetpacket);
offset += 4;
WriteUInt32(entity.Meshoffsetpacket);
offset += 4;
WriteString(entity.Nameoffsetpacket);
offset += 20;
WriteUInt64(entity.Donationoffsetpacket);
offset += 8;
entity.Rank getMyRank(entity.Donationrank);
WriteUInt32((uint)entity.Rankoffsetpacket);
offset += 4;
WriteUInt32((uint)rankoffsetpacket);
offset += 4;
rank++;
}
WriteUInt16(rank12packet);
client.Send(packet);
break;
}
}
}

        private static 
void Sort(uint p)
        {
            throw new 
NotImplementedException();
        }
        private static 
NobilityRank getMyRank(ulong donationint currentRank)
        {
            if (
currentRank >= && currentRank 999999)
            {
                return 
NobilityRank.King;
            }
            else if (
currentRank >= 10 && currentRank 0)
            {
                return 
NobilityRank.Prince;
            }
            else if (
currentRank >= 50 && currentRank 0)
            {
                return 
NobilityRank.Duke;
            }
            else
            {
                return 
NobilityRank.Serf;
            }
        }
        public static 
void Donate(ulong silversClient.GameState client)
{
bool newDonator false;
client.NobilityInformation.Gender = (byte)(client.Entity.Body 10);
if (
client.NobilityInformation.Donation == 0newDonator true;
client.NobilityInformation.Donation += silvers;
int oldpos client.NobilityInformation.Position;
if (!
Board.ContainsKey(client.Entity.UID) && client.NobilityInformation.Donation == silvers && newDonator)
{
Board.Add(client.Entity.UIDclient.NobilityInformation);
try
{
Database.NobilityTable.InsertNobilityInformation(c lient.NobilityInformation);
}
catch
{
Database.NobilityTable.UpdateNobilityInformation(c lient.NobilityInformation);
}
}
else
{
Database.NobilityTable.UpdateNobilityInformation(c lient.NobilityInformation);
}
updateOthers(oldposclient);
}
        private static 
void updateOthers(int oldPositionGameState client)
        {
            
int newpos getPosition(client.Entity.UID);
            var 
Rank getMyRank(client.NobilityInformation.Donationnewpos);

            if (
oldPosition != newpos)
            {
                if (
Rank == NobilityRank.King || Rank == NobilityRank.Prince || Rank == NobilityRank.Duke)
                    foreach (var 
p in Board.Values.OrderByDescending(=> e.Donation).Skip(newpos).Take(50 newpos))
                    {
                        
GameState cl null;
                        if (
Kernel.GamePool.TryGetValue(p.EntityUIDout cl))
                            
SendIconToClient(cl);
                    }
            }
            
SendIconToClient(client);
        }
        private static 
int getPosition(uint entityuid)
        {
            
int currentPos = -1post = -1;
            if (
Board.ContainsKey(entityuid))
            {
                foreach (var 
p in Board.Values.OrderByDescending(=> e.Donation))
                {
                    
currentPos++;
                    if (
entityuid == p.EntityUID)
                    {
                        
post currentPos;
                        break;
                    }
                }
            }
            return 
post;
        }
        public static 
void SendIconToClient(Client.GameState client)
        {
            if (
client != null && client.NobilityInformation != null)
            {
                
int pos getPosition(client.Entity.UID);
                
client.Entity.NobilityRank client.NobilityInformation.Rank getMyRank(client.NobilityInformation.Donationpos);
                
NobilityInfo update = new NobilityInfo(true);
                
update.Type NobilityInfo.Icon;
                
update.dwParam client.Entity.UID;
                
client.NobilityInformation.Position pos;
                
update.UpdateString(client.NobilityInformation);
                
client.SendScreen(updatetrue);
            }
        }
    }
    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 
enum NobilityRank byte
    
{
        
Serf 0,
        
Knight 1,
        
Baron 3,
        
Earl 5,
        
Duke 7,
        
Prince 9,
        
King 12,
    }


ظبها بقا لان ف حاجات انته باعتها
c lient
خليها
client

قديم 2019-09-16, 04:38 AM
المشاركة 6
ViORX
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: الاكونت اول مابينزل بيكون Earl من غير مايكون دافع حاجة فى الدونيشن
كود:
using system;
using system.io;
using system.linq;
using viorx.client;
using system.collections.generic;
using viorx.network.gamepackets;

namespace 
viorx.game.conquerstructures
{
    public class 
nobility Network.writer
    
{
        public static 
safedictionary<uintnobilityinformationboard = new safedictionary<uintnobilityinformation>(10000);
        public static 
void handle(nobilityinfo informationclient.gamestate client)
{
switch (
information.type)
{
case 
nobilityinfo.donate:
{
if (
client.trade.intrade)
return;
if (
client.entity.pokerhack == true)
return;
ulong silvers information.dwparam;
bool newdonator false;
client.nobilityinformation.gender = (byte)(client.entity.body 10);
if (
client.nobilityinformation.donation == 0)
newdonator true;
if (
information.moneytype == 1)
{
ulong cps silvers 1;
if (
client.entity.conquerpoints >= cps)
{
client.entity.conquerpoints -= (uint)cps;
client.nobilityinformation.donation += silvers;
}
}
else
{
if (
client.entity.money >= silvers)
{
client.entity.money -= (ulong)silvers;
client.nobilityinformation.donation += silvers;
}
}

if (!
board.containskey(client.entity.uid) && client.nobilityinformation.donation == silvers && newdonator)
{
board.add(client.entity.uidclient.nobilityinformation);
try
{
database.nobilitytable.insertnobilityinformation(c lient.nobilityinformation);
}
catch
{
database.nobilitytable.updatenobilityinformation(c lient.nobilityinformation);
}
}
else
{
database.nobilitytable.updatenobilityinformation(c lient.nobilityinformation);
}
sort(client.entity.uid);
break;
}
case 
nobilityinfo.list:
{
byte[] packet = new byte[608];
writeuint16((ushort)(packet.length 8), 0packet);
writeuint16(20642packet);
writeuint16(24packet);
writeuint16((ushort)(board.count 50 : (board.count 10) + 1), 10packet);
int offset 120;
ushort rank 0;
rank = (ushort)(information.wparam1 10);
foreach (var 
entity in board.values.orderbydescending(=> e.donation).skip(information.wparam1 10).take(10))
{
writeuint32(entity.entityuidoffsetpacket);
offset += 4;
writeuint32(1offsetpacket);
offset += 4;
writeuint32(entity.meshoffsetpacket);
offset += 4;
writestring(entity.nameoffsetpacket);
offset += 20;
writeuint64(entity.donationoffsetpacket);
offset += 8;
entity.rank getmyrank(entity.donationrank);
writeuint32((uint)entity.rankoffsetpacket);
offset += 4;
writeuint32((uint)rankoffsetpacket);
offset += 4;
rank++;
}
writeuint16(rank12packet);
client.send(packet);
break;
}
}
}

        private static 
void sort(uint p)
        {
            throw new 
notimplementedexception();
        }
        private static 
nobilityrank getmyrank(ulong donationint currentrank)
        {
            if (
currentrank >= && currentrank 999999)
            {
                return 
nobilityrank.king;
            }
            else if (
currentrank >= 10 && currentrank 0)
            {
                return 
nobilityrank.prince;
            }
            else if (
currentrank >= 50 && currentrank 0)
            {
                return 
nobilityrank.duke;
            }
            else
            {
                return 
nobilityrank.serf;
            }
        }
        public static 
void donate(ulong silversclient.gamestate client)
{
bool newdonator false;
client.nobilityinformation.gender = (byte)(client.entity.body 10);
if (
client.nobilityinformation.donation == 0newdonator true;
client.nobilityinformation.donation += silvers;
int oldpos client.nobilityinformation.position;
if (!
board.containskey(client.entity.uid) && client.nobilityinformation.donation == silvers && newdonator)
{
board.add(client.entity.uidclient.nobilityinformation);
try
{
database.nobilitytable.insertnobilityinformation(c lient.nobilityinformation);
}
catch
{
database.nobilitytable.updatenobilityinformation(c lient.nobilityinformation);
}
}
else
{
database.nobilitytable.updatenobilityinformation(c lient.nobilityinformation);
}
updateothers(oldposclient);
}
        private static 
void updateothers(int oldpositiongamestate client)
        {
            
int newpos getposition(client.entity.uid);
            var 
rank getmyrank(client.nobilityinformation.donationnewpos);

            if (
oldposition != newpos)
            {
                if (
rank == nobilityrank.king || rank == nobilityrank.prince || rank == nobilityrank.duke)
                    foreach (var 
p in board.values.orderbydescending(=> e.donation).skip(newpos).take(50 newpos))
                    {
                        
gamestate cl null;
                        if (
kernel.gamepool.trygetvalue(p.entityuidout cl))
                            
sendicontoclient(cl);
                    }
            }
            
sendicontoclient(client);
        }
        private static 
int getposition(uint entityuid)
        {
            
int currentpos = -1post = -1;
            if (
board.containskey(entityuid))
            {
                foreach (var 
p in board.values.orderbydescending(=> e.donation))
                {
                    
currentpos++;
                    if (
entityuid == p.entityuid)
                    {
                        
post currentpos;
                        break;
                    }
                }
            }
            return 
post;
        }
        public static 
void sendicontoclient(client.gamestate client)
        {
            if (
client != null && client.nobilityinformation != null)
            {
                
int pos getposition(client.entity.uid);
                
client.entity.nobilityrank client.nobilityinformation.rank getmyrank(client.nobilityinformation.donationpos);
                
nobilityinfo update = new nobilityinfo(true);
                
update.type nobilityinfo.icon;
                
update.dwparam client.entity.uid;
                
client.nobilityinformation.position pos;
                
update.updatestring(client.nobilityinformation);
                
client.sendscreen(updatetrue);
            }
        }
    }
    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 
enum nobilityrank Byte
    
{
        
serf 0,
        
knight 1,
        
baron 3,
        
earl 5,
        
duke 7,
        
prince 9,
        
king 12,
    }


ظبها بقا لان ف حاجات انته باعتها
c lient
خليها
client
عاش تسلم ايدك ياكبير
تحياتى ليك


العلامات المرجعية



الذين يشاهدون محتوى الموضوع الآن : 1 ( الأعضاء 0 والزوار 1)
 

الانتقال السريع

المواضيع المتشابهه للموضوع: الاكونت اول مابينزل بيكون Earl من غير مايكون دافع حاجة فى الدونيشن
الموضوع كاتب الموضوع المنتدى مشاركات آخر مشاركة
ازاى اعدل علي شكل التوب الي بيكون علي الاكونت Omar Mohamed100 مشكلات السيرفيرات كونكر الشخصيه 4 2023-10-30 07:10 PM
طلب بخصوص حاجة جمب الاسم abdocoder مشكلات السيرفيرات كونكر الشخصيه 2 2020-04-29 06:14 PM
حاجة مهمة مساعده من اى شخص محترم nova مشكلات السيرفيرات كونكر الشخصيه 2 2019-11-18 11:14 PM
محتاج شرح كما حاجة كده بسيط اسلام مشكلات السيرفيرات كونكر الشخصيه 1 2019-09-26 07:13 AM
حل مشكله بقاء الاكونت في التوب بعد اغلاق وفتحه الاكونت Tefa تطوير سيرفرات كونكر 0 2019-08-02 08:44 PM


الساعة الآن 03:03 AM

Powered by vBulletin® Copyright ©2000 - 2019, Jelsoft Enterprises Ltd.