قديم 2020-02-14, 07:40 PM
المشاركة 2
محمد ياسر
*
  • غير متواجد
افتراضي رد: هام جدا....للضروره
انت ابحث عن الرقم الي الكابس بياخد كام جولد وعدله للي انت عايزها

قديم 2020-02-14, 10:28 PM
المشاركة 3
Thinker
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: هام جدا....للضروره
انت ابحث عن الرقم الي الكابس بياخد كام جولد وعدله للي انت عايزها

كود:
{
        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)
        {
            switch (
information.Type)
            {
                case 
NobilityInfo.Donate:
                    {
                        if (
client.Trade.InTrade)
                            return;
                        if (
client.Player.PokerHack == true)
                            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 1;
                            if (
client.Player.ConquerPoints >= cps)
                            {
                                
client.Player.ConquerPoints -= (uint)cps;
                                
client.NobilityInformation.Donation += silvers;
                            }
                        }
                        else
                        {
                            if (
client.Player.Money >= silvers)
                            {
                                
client.Player.Money -= (ulong)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];
                        
WriteUInt16(6000packet);
                        
WriteUInt16(20642packet);
                        
WriteUInt16(24packet);
                        
WriteUInt16(510packet);
                        
WriteUInt16(1012packet);
                        
int offset 120;
                        for (
int i = (int)(information.wParam1 10); information.wParam1 10 10 && BoardList.Counti++)
                        {
                            var 
nob BoardList[i];
                            
WriteUInt32(nob.EntityUIDoffsetpacket);
                            
offset += 4;
                            if (
Kernel.GamePool.ContainsKey(nob.EntityUID))
                            {
                                
WriteUInt32(1offsetpacket);
                                
offset += 4;
                                
WriteUInt32(nob.Meshoffsetpacket);
                                
offset += 4;
                            }
                            else
                            {
                                
offset += 8;
                            }
                            
WriteString(nob.Nameoffsetpacket);
                            
offset += 20;
                            
WriteUInt64(nob.Donationoffsetpacket);
                            
offset += 8;
                            
WriteUInt32((uint)nob.Rankoffsetpacket);
                            
offset += 4;
                            
WriteUInt32((uint)ioffsetpacket);
                            
offset += 4;
                        }
                        
client.Send(packet);

                        
information.Type NobilityInfo.NextRank;
                        
ulong value 0;
                        
information.dwParam2 0;
                        
lock (BoardList)
                        {
                            if (
client.NobilityInformation.Rank == NobilityRank.Prince)
                                
value = (ulong)(BoardList[02].Donation client.NobilityInformation.Donation 1);
                            if (
client.NobilityInformation.Rank == NobilityRank.Duke)
                                
value = (ulong)(BoardList[14].Donation client.NobilityInformation.Donation 1);

                        }
                        
Network.Writer.WriteUInt64(value8information.ToArray());
                        
information.dwParam3 60;
                        
information.dwParam4 uint.MaxValue;
                        
client.Send(information);
                        break;
                    }
            }
        }
        public static 
void Donate(ulong silversClient.GameState client)
        {
            
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 >= 5000)
                    {
                        if (
entry.Donation >= 20000)
                        {
                            
Rank NobilityRank.Earl;
                        }
                        else if (
entry.Donation >= 1000)
                        {
                            
Rank NobilityRank.Baron;
                        }
                        else if (
entry.Donation >= 300)
                        {
                            
Rank NobilityRank.Knight;
                        }
                    }
                    else
                    {
                        if (
Place 10)//serverrank
                        
{
                            
Rank NobilityRank.King;
                            if (
Place < (5))
                            {
                                
MaxDonation entry.Donation;
                            }
                        }
                        else if (
Place 5000)
                        {
                            
Rank NobilityRank.Prince;
                            if (
Place < (5000))
                            {
                                
MaxDonation1 entry.Donation;
                            }
                        }
                        else if (
Place 50000)
                        {
                            
Rank NobilityRank.Duke;
                            if (
Place < (50000))
                            {
                                
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 " For New Rank [ Baron ] In [Crazy-Co]."System.Drawing.Color.WhiteMessage.TopLeft), Program.Values);
                            }
                            if (
Rank == NobilityRank.Earl)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Player.Name "  For New Rank [ Earl ] In [Crazy-Co]."System.Drawing.Color.WhiteMessage.TopLeft), Program.Values);
                            }
                            if (
Rank == NobilityRank.Duke)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Player.Name " has the " + (string)(Network.PacketHandler.IsBoy(entry.Mesh 10000) == true "Duke" "Duchess") + " In [Crazy-Co]."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.Prince)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Player.Name " has the " + (string)(Network.PacketHandler.IsBoy(entry.Mesh 10000) == true "Prince" "Princess") + " In [Crazy-Co]."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.King)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Player.Name " has become the New " + (string)(Network.PacketHandler.IsBoy(entry.Mesh 10000) == true "King" "Queen") + " In [Crazy-Co]."System.Drawing.Color.WhiteMessage.Center), Program.Values);
                            }
                            if (
Rank == NobilityRank.Knight)
                            {
                                
Kernel.SendWorldMessage(new Message("Congratulation! " client.Player.Name " has become a Knight By [Crazy-Co]."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 static 
void Delet(Client.GameState client)
        {
            if (
Game.ConquerStructures.Nobility.Board.ContainsKey(client.Player.UID))
            {
                
Game.ConquerStructures.Nobility.Board.Remove(client.Player.UID);
                
Game.ConquerStructures.Nobility.Sort(0);
                foreach (var 
clients in Program.GamePool)
                {
                    if (
Game.ConquerStructures.Nobility.Board.ContainsKey(clients.Player.UID))
                        
Game.ConquerStructures.Nobility.Sort(client.Player.UID);
                }
                
Database.MySqlCommand cmd = new Database.MySqlCommand(Database.MySqlCommandType.DELETE).Delete("nobility""EntityUID"client.Player.UID);
                
cmd.Execute();
            }
        }
    } 

    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
    
}


انا مش شايف اي ارقام معلش ياغالي انا جديد فى المجال

قديم 2020-02-14, 10:49 PM
المشاركة 4
محمد ياسر
*
  • غير متواجد
افتراضي رد: هام جدا....للضروره
ده ملف التبرع مش الهاندل

قديم 2020-02-14, 11:50 PM
المشاركة 5
Thinker
.:: عضو نشيط ::.
  • غير متواجد
افتراضي رد: هام جدا....للضروره
'طب ممكن تقولى الاقيها فى اي ملف؟

قديم 2020-02-15, 01:36 AM
المشاركة 6
MRonlineGvrix
.:: عضو مميز ::.
  • غير متواجد
افتراضي رد: هام جدا....للضروره
رايح دماغك خش على كلاس Npc

بدل دا با الى عندك


كود:
                #region Nobility
                
case 7611:
                    {
                        {
                            switch (
npcRequest.OptionID)
                            {
                                case 
0:
                                    {
                                        
dialog.Text("Hello*friend.*I*can*help*you*get*on*the*top*faster!*Instead*of*donating*gold,*you*can*give*me*your*cps*and*I*will*automatically*do*the*hard*work*for*you.*The*exchange*ratio*is*1:50000.*That*means*you*give*me*1*CPs,*I*donate*for*you*50000*gold.*The*minimum*amount*is*10,000*CPs.");
                                        
dialog.Input("Insert*amount:"110);
                                        
dialog.Option("No*thank*you."255);
                                        break;
                                    }
                                case 
1:
                                    {
                                        
uint input;
                                        if (
uint.TryParse(npcRequest.Inputout input))
                                        {
                                            if (
input 10000)
                                            {
                                                
dialog.Text("You*need*to*input*more*or*atleast*10,000*CPs..");
                                                
dialog.Input("Insert*amount:"19);
                                                
dialog.Option("No*thank*you."255);
                                                return;
                                            }
                                            if (
client.Entity.ConquerPoints >= input)
                                            {
                                                
client.NpcCpsInput input;
                                                
dialog.Text("Are*you*sure*you*want*to*donate*" input "*CPs?*That*means*I*will*donate*for*you*" + (((ulong)input) * 1ul) + "*gold.");
                                                
dialog.Option("Yes"2);
                                                
dialog.Option("No*thank*you."255);
                                            }
                                            else
                                            {
                                                
dialog.Text("You*don't*have*that*much*CPs.*Try*again.*\nThe*exchange*ratio*is*1:1000.*That*means*you*give*me*1*CPs,*I*donate*for*you*1000*gold.*The*minimum*amount*is*100,000*CPs.");
                                                
dialog.Input("Insert*amount:"19);
                                                
dialog.Option("No*thank*you."255);
                                            }
                                        }
                                        else
                                        {
                                            
dialog.Text("Try*again.*\nThe*exchange*ratio*is*1:1000.*That*means*you*give*me*1*CPs,*I*donate*for*you*50000*gold.*The*minimum*amount*is*100,000*CPs.");
                                            
dialog.Input("Insert*amount:"19);
                                            
dialog.Option("No*thank*you."255);
                                        }
                                        break;
                                    }
                                case 
2:
                                    {
                                        if (
client.Entity.ConquerPoints >= client.NpcCpsInput && client.NpcCpsInput != 0)
                                        {
                                            
client.Entity.ConquerPoints -= client.NpcCpsInput;
                                            
Game.ConquerStructures.Nobility.Donate((ulong)client.NpcCpsInput 1ulclienttrue);
                                            
client.NpcCpsInput 0;
                                        }
                                        break;
                                    }
                            }
                            break;
                        }
                    }
                
#endregion 



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



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

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



الساعة الآن 12:33 AM

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