قديم 2020-04-04, 02:01 PM
المشاركة 2
ElSaher
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكلة في الرانك يا رجاله
سهلا يا احمد امسح الكلاس Nobility امسح كل الي فيه وبدلو بي دا


كود:
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<uintNobilityInformationBoard = new SafeDictionary<uintNobilityInformation>(10000);
        public static List<
NobilityInformationBoardList = new List<NobilityInformation>(10000);
        public static 
void Handle(NobilityInfo informationClient.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.UIDclient.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(6000packet);
                        
Network.Writer.WriteUInt16(20642packet);
                        
Network.Writer.WriteUInt16(24packet);
                        
Network.Writer.WriteUInt16(510packet);
                        
Network.Writer.WriteUInt16(2012packet);
                        
int offset 120;
                        for (
int i = (int)(information.wParam1 10); information.wParam1 10 10 && BoardList.Counti++)
                        {
                            var 
nob BoardList[i];
                            
Network.Writer.WriteUInt32(nob.EntityUIDoffsetpacket);
                            
offset += 4;
                            if (
Kernel.GamePool.ContainsKey(nob.EntityUID))
                            {
                                
Network.Writer.WriteUInt32(1offsetpacket);
                                
offset += 4;
                                
Network.Writer.WriteUInt32(nob.Meshoffsetpacket);
                                
offset += 4;
                            }
                            else
                            {
                                
offset += 8;
                            }
                            
Network.Writer.WriteString(nob.Nameoffsetpacket);
                            
offset += 20;
                            
Network.Writer.WriteUInt64(nob.Donationoffsetpacket);
                            
offset += 8;
                            
Network.Writer.WriteUInt32((uint)nob.Rankoffsetpacket);
                            
offset += 4;
                            
Network.Writer.WriteUInt32((uint)ioffsetpacket);
                            
offset += 4;
                        }
                        
client.Send(packet);
                        break;
                    }
            }
        }
        public static 
void Donate(ulong silversClient.GameState clientbool 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.UIDclient.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<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 >= 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.EntityUIDout 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.WhiteMessage.TopLeft), Program.Values);
                            }
                            if (
Rank == NobilityRank.Earl)
                            {
                                
Kernel.SendWorldMessage(new Message(" Congratulation " client.Player.Name " has the Earl In Pharaohs-Eu "System.Drawing.Color.WhiteMessage.TopLeft), Program.Values);
                            }
                            if (
Rank == NobilityRank.Duke)
                            {
                                
Kernel.SendWorldMessage(new Message(" Congratulation " client.Player.Name " has the Duke In Pharaohs-Eu "System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.Prince)
                            {
                                
Kernel.SendWorldMessage(new Message(" Congratulation " client.Player.Name " has the Prince In Pharaohs-Eu "System.Drawing.Color.WhiteMessage.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.WhiteMessage.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.WhiteMessage.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(updatetrue);
                            
client.Player.NobilityRank entry.Rank;
                        }
                    }
                    
sortedBoard.Add(entry.EntityUIDentry);
                    
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
    
}


هتغير Mr_Panda بي اسم البروجكت بتاعك
وهتغير دا Pharaohs-Eu بي اسم لعبتك

ملحوظه معمول كلو كنجات

قديم 2020-04-05, 03:34 AM
المشاركة 3
Tefa
.:: عضو خبير ::.
  • غير متواجد
افتراضي رد: مشكلة في الرانك يا رجاله
هتبحث عن الجزء الخاص بالفلوس في Nobility

كود:
 if (client.Player.Money >= silvers)
                            {
                                
client.Player.Money -= (uint)silvers;
                                
client.NobilityInformation.Donation += silvers;
                            } 

امسحه و حط مكانه return;


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



الذين يشاهدون محتوى الموضوع الآن : 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


الساعة الآن 01:48 AM

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