منتدي زيرو vb - zerovb

منتدي زيرو vb - zerovb (https://forum.vpscairo.com/index.php)
-   تطوير سيرفرات كونكر تهيس Conquer Private Servers (https://forum.vpscairo.com/forumdisplay.php?f=83)
-   -   Transfer System in forum.vpscairo.win المفرود الموضوع يتثبت =D (https://forum.vpscairo.com/showthread.php?t=9301)

Mr.DeMo 12-11-2015 12:58 AM

Transfer System in forum.vpscairo.win المفرود الموضوع يتثبت =D
 
نظـام النقـل بيـن السيـرفرات !

هنخـش ع الاضـأفـات علشـان مبحـبش اكلـم كتيـر

هنعمـل NewFolder سميـة اي حـاجا

واعمـل فيـة كـلآس اسـمو
كود PHP:

Transfer.cs 

وحـط جـواه دول

كود PHP:

/* 
Created By MrMazika
*/
using Conquer_Online_Server.Database;
using Conquer_Online_Server.Client;
namespace 
Conquer_Online_Server
{
    public 
unsafe class Transfer
    
{
        public static 
uint IsOnlinecantransScorpenProjectScorpenProject1;
        public static 
bool DTrans false;
        public static 
void ScorpenWork(string serverGameClient client)
        {

            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("accounts").Where("EntityID"client.Entity.UID))
            
using (var reader = new MySqlReader(cmd))
            {
                if (
reader.Read())
                {
                    
cantrans reader.ReadUInt32("CanTrans");
                }
            }
            if (
cantrans >= 3)
            {
                
client.MessageBox("Oooh o.o ! you already transfered (3)  times so you can`t   transfer   more for times."nullnull0);
                return;
            }
            else if (
Constants.ServerName == server)
            {
                
client.MessageBox("Ooops O.o ! you already in Server " server "."nullnull0);
                return;
            }
            else
            {
                
client.MessageBox("Are you sure you want to   transfer    to " server " Server you have [" + (cantrans) + "] times to  transfer",
                 (
p) =>
                 {
                     if (!
client.WarehouseOpen && client.WarehousePW != 0)
                     {
                         
client.MessageBox("  Make sure you have entered  a correct secondary password in the warehouse!"nullnull0);
                         return;
                     }
                     else
                     {
                         if (
client.Entity.ConquerPoints 2999)
                         {
                             
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("servers").Where("Name"server))
                             
using (var reader = new MySqlReader(cmd))
                             {
                                 if (
reader.Read())
                                 {
                                     
IsOnline reader.ReadUInt32("Online");
                                 }
                             }
                             if (
IsOnline == 1)
                             {
                                 
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                                     
cmd.Update("accounts").Set("server"server)
                                         .
Where("EntityID"client.Entity.UID).Execute();
                                 
cantrans++;
                                 
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                                     
cmd.Update("accounts").Set("CanTrans"cantrans)
                                         .
Where("EntityID"client.Entity.UID).Execute();
                                 
client.Entity.ConquerPoints -= 2999;
                                 
client.MessageBox("transfer to server " server " [Successfully]."nullnull0);
                                 
DTrans true;
                             }
                             else
                             {
                                 
//client.Disconnect();
                                 
client.MessageBox("transfer to server " server " [Falid]."nullnull0);
                                 return;
                             }
                         }
                         else
                         {
                             
client.MessageBox("You don't have 2999 CPs."nullnull0);
                             return;
                         }
                     }
                 });
            }
        }
        public static 
void StatusServers()
        {
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("servers").Where("Name""ScorpenProject"))
            
using (var reader = new MySqlReader(cmd))
            {
                if (
reader.Read())
                {
                    
ScorpenProject reader.ReadUInt32("Online");
                }
            }
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("servers").Where("Name""ScorpenProject1"))
            
using (var reader = new MySqlReader(cmd))
            {
                if (
reader.Read())
                {
                    
ScorpenProject1 reader.ReadUInt32("Online");
                }
            }
        }
    }


واعمـل كـلآس تـاني بـاسم

كود PHP:

TransferCipher.cs 

وحـط دول جواة .

كود PHP:

http://up.top4top.net/downloadf-top4top_76cf679d3e1-rar.html 

وبعدين افتح

كود PHP:

Npc.cs 

وحط فيـة الانبسي دا

كود PHP:

http://up.top4top.net/downloadf-top4top_1764d208dc1-rar.html 

وبـعديـن افتـح

كود PHP:

PacketHandle.cs 

وبحـث عـن
كود PHP:

if (ID == 1009

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

كود PHP:

#region Transfer 
                
case 2900
                    { 
                        switch (
packet[4]) 
                        { 
                            case 
0
                                { 
                                    
uint[] array = new uint[] { 3743 }; 
                                    
byte[] Buffer = new byte[* array.Length]; 
                                    
Writer.Ushort((ushort)(Buffer.Length 8), 0Buffer); 
                                    
Writer.Ushort(29012Buffer); 
                                    
Buffer[5] = (byte)array.Length
                                    
int offset 6
                                    for (
int i 0< array.Lengthi++) 
                                    { 
                                        
Writer.Uint(array[i], offsetBuffer); offset += 4
                                        
Buffer[offset] = 1offset += 1
                                    } 
                                    
client.Send(Buffer); 
                                    break; 
                                } 
                            default: 
                                
PrintPacket(packet); 
                                break; 
                        } 
                        break; 
                    } 
                case 
2902
                    { 
                        
byte serverid packet[5]; 
                        break; 
                    } 
    static 
void AppendConnect(Connect appendConnectClient.GameClient client)
        {
            if (
CrossServer.CrossPool.ContainsKey(appendConnect.Identifier))
            {
                
TransferCipher.Key Encoding.ASCII.GetBytes("6D1B73DA0250473496C2845F91FA2A42");
                
TransferCipher.Salt Encoding.ASCII.GetBytes("DDA177642131459FBFBD17D9003678A8");
                
TransferCipher transferCipher = new TransferCipher("127.0.0.1");
                
uint[] decrypted transferCipher.Decrypt(new uint[] { appendConnect.IdentifierappendConnect.Identifier });

                
lock (LoginSyncRoot)
                {
                    
CrossServer.AppendConnect(appendConnectclient);
                }
            }
            else
            {
                if (
client.LoggedIn)
                {
                    
client.Disconnect(true);
                    return;
                }
                
bool doLogin false;
                
lock (LoginSyncRoot)
                {
                    
Database.AccountTable Account null;
                    if (
Kernel.AwaitingPool.TryGetValue(appendConnect.Identifierout Account))
                    {
                        if (!
Account.MatchKey(appendConnect.Identifier))
                        {
                            
client.Disconnect(false);
                            return;
                        }

                        
client.Account Account;




                        if (
Account.EntityID == 0)
                        {
                            
client.Socket.OverrideTiming true;
                            
client.Send(new Message("NEW_ROLE",  "ALLUSERS"System.Drawing.Color.OrangeGamePackets.Message.Dialog));
                            return;
                        }
                        if (
Kernel.DisconnectPool.ContainsKey(Account.EntityID))
                        {
                            
client.Send(new Message("Please try again  after a minute!""ALLUSERS"System.Drawing.Color.Orange,  GamePackets.Message.Dialog));
                            return;
                        }
                        
VariableVault variables;
                        
Database.EntityVariableTable.Load(client.Account.EntityIDout variables);
                        
client.Variables variables;

                        if (
client["banhours"] == 0)
                        {
                            
client["banhours"] = -1;
                            
client["banreason"] = "Infinite time.";
                            
client["banstamp"] = DateTime.Now.AddYears(100);
                        }
                        if (
Account.State == Database.AccountTable.AccountState.Banned)
                        {
                            if (
client["banhours"] != -1)
                            {
                                
DateTime banStamp client["banstamp"];
                                if (
DateTime.Now >  banStamp.AddDays(((int)client["banhours"]) /  24).AddHours(((int)client["banhours"]) % 24))
                                    
Account.State Database.AccountTable.AccountState.Player;
                            }
                        }
                        
string Message "";
                        if (
Account.State == Database.AccountTable.AccountState.Banned)
                        {
                            
DateTime banStamp client["banstamp"];
                            
banStamp banStamp.AddHours(client["banhours"]);
                            
Message "You are banned for " +  client["banhours"] + " hours [until " banStamp.ToString("HH:mm  MM/dd/yyyy") + "]. Reason: " client["banreason"];
                        }
                        else if (
Account.State == Database.AccountTable.AccountState.NotActivated)
                            
Message "You cannot login until your account is activated.";
                        
Kernel.AwaitingPool.Remove(appendConnect.Identifier);
                        if (
Message == string.Empty) // ANSWER_OK
                        
{
                            
Client.GameClient aClient null;
                            if (
Kernel.GamePool.TryGetValue(Account.EntityIDout aClient))
                                
aClient.Disconnect();
                            
Kernel.GamePool.Remove(Account.EntityID);
                            
client.Entity = new Entity(EntityFlag.Monsterfalse);
                            
Kernel.GamePool.Add(Account.EntityIDclient);
                            
doLogin true;
                        }
                        else
                        {
                            
client.Send(new Message(Message"ALLUSERS",  System.Drawing.Color.OrangeGamePackets.Message.Dialog));
                            
World.Execute<GameClient>((pClienttime) => { pClient.Disconnect(); }, client100);
                        }
                    }
                }
                if (
doLogin)
                {
                    
client.GetLanguages(appendConnect.Language);
                    
DoLogin(client);
                }
            }
        }            
#endregion 

وبحـث عـن

كود PHP:

static void AppendConnect(Connect appendConnect 

وبدلـو بدا

كود PHP:

static void AppendConnect(Connect appendConnectClient.GameClient client)
        {
            if (
CrossServer.CrossPool.ContainsKey(appendConnect.Identifier))
            {
                
TransferCipher.Key Encoding.ASCII.GetBytes("6D1B73DA0250473496C2845F91FA2A42");
                
TransferCipher.Salt Encoding.ASCII.GetBytes("DDA177642131459FBFBD17D9003678A8");
                
TransferCipher transferCipher = new TransferCipher("127.0.0.1");
                
uint[] decrypted transferCipher.Decrypt(new uint[] { appendConnect.IdentifierappendConnect.Identifier });

                
lock (LoginSyncRoot)
                {
                    
CrossServer.AppendConnect(appendConnectclient);
                }
            }
            else
            {
                if (
client.LoggedIn)
                {
                    
client.Disconnect(true);
                    return;
                }
                
bool doLogin false;
                
lock (LoginSyncRoot)
                {
                    
Database.AccountTable Account null;
                    if (
Kernel.AwaitingPool.TryGetValue(appendConnect.Identifierout Account))
                    {
                        if (!
Account.MatchKey(appendConnect.Identifier))
                        {
                            
client.Disconnect(false);
                            return;
                        }

                        
client.Account Account;




                        if (
Account.EntityID == 0)
                        {
                            
client.Socket.OverrideTiming true;
                            
client.Send(new Message("NEW_ROLE",  "ALLUSERS"System.Drawing.Color.OrangeGamePackets.Message.Dialog));
                            return;
                        }
                        if (
Kernel.DisconnectPool.ContainsKey(Account.EntityID))
                        {
                            
client.Send(new Message("Please try again  after a minute!""ALLUSERS"System.Drawing.Color.Orange,  GamePackets.Message.Dialog));
                            return;
                        }
                        
VariableVault variables;
                        
Database.EntityVariableTable.Load(client.Account.EntityIDout variables);
                        
client.Variables variables;

                        if (
client["banhours"] == 0)
                        {
                            
client["banhours"] = -1;
                            
client["banreason"] = "Infinite time.";
                            
client["banstamp"] = DateTime.Now.AddYears(100);
                        }
                        if (
Account.State == Database.AccountTable.AccountState.Banned)
                        {
                            if (
client["banhours"] != -1)
                            {
                                
DateTime banStamp client["banstamp"];
                                if (
DateTime.Now >  banStamp.AddDays(((int)client["banhours"]) /  24).AddHours(((int)client["banhours"]) % 24))
                                    
Account.State Database.AccountTable.AccountState.Player;
                            }
                        }
                        
string Message "";
                        if (
Account.State == Database.AccountTable.AccountState.Banned)
                        {
                            
DateTime banStamp client["banstamp"];
                            
banStamp banStamp.AddHours(client["banhours"]);
                            
Message "You are banned for " +  client["banhours"] + " hours [until " banStamp.ToString("HH:mm  MM/dd/yyyy") + "]. Reason: " client["banreason"];
                        }
                        else if (
Account.State == Database.AccountTable.AccountState.NotActivated)
                            
Message "You cannot login until your account is activated.";
                        
Kernel.AwaitingPool.Remove(appendConnect.Identifier);
                        if (
Message == string.Empty) // ANSWER_OK
                        
{
                            
Client.GameClient aClient null;
                            if (
Kernel.GamePool.TryGetValue(Account.EntityIDout aClient))
                                
aClient.Disconnect();
                            
Kernel.GamePool.Remove(Account.EntityID);
                            
client.Entity = new Entity(EntityFlag.Monsterfalse);
                            
Kernel.GamePool.Add(Account.EntityIDclient);
                            
doLogin true;
                        }
                        else
                        {
                            
client.Send(new Message(Message"ALLUSERS",  System.Drawing.Color.OrangeGamePackets.Message.Dialog));
                            
World.Execute<GameClient>((pClienttime) => { pClient.Disconnect(); }, client100);
                        }
                    }
                }
                if (
doLogin)
                {
                    
client.GetLanguages(appendConnect.Language);
                    
DoLogin(client);
                }
            }
        } 

واعمـل كـلآس جـديـد بـأسم
كود PHP:

RivestCipher5 

وحـط جـواة دول

كود PHP:

using System
using System.Linq
using System.Text
using System.Drawing
using System.Threading.Tasks
using System.Collections.Generic
using System.Runtime.InteropServices
//MrMazika 
namespace Conquer_Online_Server.Network 

    public 
unsafe static class NativeFunctionCalls 
    

        public const 
string MSVCRT "msvcrt.dll"
        public const 
string KERNEL32 "kernel32.dll"
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern unsafe voidmalloc(int size); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern unsafe voidcalloc(int size); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern unsafe void free(voidmemblock); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern voidmemset(voiddstbyte fillint length); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern int memcmp(voidbuf1voidbuf2int count); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern voidmemcpy(voiddstvoidsrcint length); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern voidmemcpy(voiddststring srcint length); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern voidmemcpy(byte[] dstvoidsrcint length); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern voidmemcpy(voiddstbyte[] srcint length); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern voidmemcpy(byte[] dstbyte[] srcint length); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern voidmemcpy(uint[] dstuint[] srcint length); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern voidmemcpy(byte[] dststring srcint length); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern unsafe voidrealloc(voidptrint size); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern void srand(int seed); 
        [
DllImport(MSVCRTCallingConvention CallingConvention.CdeclSetLastError false)] 
        public static 
extern short rand(); 
    } 
    public 
unsafe static class SeedGenerator 
    

        public static 
byte[] Generate(int seed
        { 
            
byte[] initializationVector = new byte[0x10]; 
            for (
int index 0index 0x10index++) 
            { 
                
seed *= 0x343fd
                
seed += 0x269ec3
                
initializationVector[index] = (byte)((seed >> 0x10) & 0x7fff); 
            } 
            return 
initializationVector
        } 
    } 
    public 
unsafe sealed class RivestCipher5 
    

        private const 
int KEY_SIZE 4
        private const 
int SEED_SIZE 16
        private const 
int SUBSTITUTION_SIZE 26
        private const 
int BITS_SHIFTED 32
        private static 
byte[] _initializationVector = { 0x3C0xDC,  0xFE0xE80xC40x540xD60x7E0x160xA60xF80x1A0xE80xD0,  0x380xBE }; 
        private 
uint[] _keyBuffer
        private 
uint[] _substitutionBuffer
        public 
RivestCipher5() 
        { 
            
GenerateKeys(_initializationVector); 
        } 
        public 
RivestCipher5(int seed
        { 
            
GenerateKeys(SeedGenerator.Generate(seed)); 
        } 
        public 
void GenerateKeys(byte[] initializationVector
        { 
            
_keyBuffer = new uint[KEY_SIZE]; 
            
_substitutionBuffer = new uint[SUBSTITUTION_SIZE]; 
            
fixed (uintkeyBufferPtr _keyBuffer
                
NativeFunctionCalls.memcpy((byte*)keyBufferPtrinitializationVectorKEY_SIZE sizeof(uint)); 

            
_substitutionBuffer[0] = 0xB7E15163
            for (
int index 1index SUBSTITUTION_SIZEindex++) 
                
_substitutionBuffer[index] = _substitutionBuffer[index 1] + 0x9E3779B9

            
uint substitutionIndex 0keyIndex 000
            for (
int loopControlIndex 0loopControlIndex SUBSTITUTION_SIZEloopControlIndex++) 
            { 
                
_substitutionBuffer[substitutionIndex] = RotateLeft(_substitutionBuffer[substitutionIndex] + y3); 
                
_substitutionBuffer[substitutionIndex]; 
                
substitutionIndex = (substitutionIndex 1) % SUBSTITUTION_SIZE
                
_keyBuffer[keyIndex] = RotateLeft(_keyBuffer[keyIndex] + y, (int)(y)); 
                
_keyBuffer[keyIndex]; 
                
keyIndex = (keyIndex 1) % KEY_SIZE
            } 
        } 
        public 
bool Decrypt(byte[] input
        { 
            if (
input.Length != 0) return false
            
uintbuffer null
            
fixed (byteptr input
                
buffer = (uint*)ptr
            
int rounds input.Length 8
            for (
int index 0index roundsindex++) 
            { 
                
uint left buffer[index]; 
                
uint right buffer[(index) + 1]; 
                for (
int subIndex 12subIndex 0subIndex--) 
                { 
                    
right RotateRight(right _substitutionBuffer[(subIndex) + 1], (int)left) ^ left
                    
left RotateRight(left _substitutionBuffer[subIndex], (int)right) ^ right
                } 
                
uint resultLeft left _substitutionBuffer[0]; 
                
uint resultRight right _substitutionBuffer[1]; 
                
buffer[index] = resultLeft
                
buffer[(index) + 1] = resultRight
            } 
            return 
true
        } 
        public 
bool Encrypt(byte[] input
        { 
            if (
input.Length != 0) return false
            
uintbuffer null
            
fixed (byteptr input
                
buffer = (uint*)ptr
            
int rounds input.Length 8
            for (
int index 0index roundsindex++) 
            { 
                
uint left buffer[index] + _substitutionBuffer[0]; 
                
uint right buffer[(index) + 1] + _substitutionBuffer[1]; 
                for (
int subIndex 1subIndex <= 12subIndex++) 
                { 
                    
left RotateLeft(left right, (int)right) + _substitutionBuffer[subIndex]; 
                    
right RotateLeft(right left, (int)left) + _substitutionBuffer[(subIndex) + 1]; 
                } 
                
buffer[index] = left
                
buffer[(index) + 1] = right
            } 
            return 
true
        } 
        public 
uint RotateLeft(uint valueint count
        { 
            
count %= BITS_SHIFTED
            
uint high value >> (BITS_SHIFTED count); 
            return (
value << count) | high
        } 
        public 
uint RotateRight(uint valueint count
        { 
            
count %= BITS_SHIFTED
            
uint low value << (BITS_SHIFTED count); 
            return (
value >> count) | low
        } 
    } 


وفتـح
كود PHP:

Program.cs 

وبحـث عـن
كود PHP:

AuthPort IniFile.ReadUInt16("configuration""AuthPort"

حـط دول تحتـو

كود PHP:

TransferCipher.Key Encoding.ASCII.GetBytes("6D1B73DA0250473496C2845F91FA2A42"); 
            
TransferCipher.Salt Encoding.ASCII.GetBytes("DDA177642131459FBFBD17D9003678A8"); 

ورفع الملف دا علي القاعدة
كود PHP:

http://up.top4top.net/downloadf-top4top_eeba4d48b31-rar.html 

واعمـل DeisgnTable علـي ملف accounts علي النـافي كـات وضيـف السطـرين دول

كود PHP:

Server    char    255    0    -1    0    0    0    0        0        utf8    utf8_general_ci        0    0 
CanTrans    bigint    18    0    
-1    0    0    0    0        0                    0    0 

افتـح

كود PHP:

Program.cs 

وبحث عـن
كود PHP:

void AuthServer_OnClientReceive 

وبدل الاكواد بالكـود دا

كود PHP:

 private static void AuthServer_OnClientReceive(byte[] bufferint lengthClientWrapper arg3)
        {
            var 
player arg3.Connector as Client.AuthClient;
            
player.Cryptographer.Decrypt(bufferlength);
            
player.Queue.Enqueue(bufferlength);
            while (
player.Queue.CanDequeue())
            {
                
byte[] packet player.Queue.Dequeue();
                
ushort len BitConverter.ToUInt16(packet0);
                
ushort id BitConverter.ToUInt16(packet2);
                if (
len == 312)
                {
                    
player.Info = new Authentication();
                    
player.Info.Deserialize(packet);
                    
player.Account = new AccountTable(player.Info.Username);
                    
Database.ServerInfo Server null;
                    
Forward Fw = new Forward();
                    if (
Database.Server.Servers.TryGetValue(player.Info.Serverout Server))
                    {
                        if (!
player.Account.exists)
                        {
                            
Fw.Type Forward.ForwardType.WrongAccount;
                            
player.Send(Fw);
                        }
                        if (
player.Account.Password == player.Info.Password && player.Account.exists)
                        {
                            
Fw.Type Forward.ForwardType.Ready;
                            if (
player.Account.EntityID == 0)
                            {
                                
using (MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT))
                                {
                                    
cmd.Select("configuration").Where("Server"Constants.ServerName);
                                    
using (MySqlReader r = new MySqlReader(cmd))
                                    {
                                        if (
r.Read())
                                        {
                                            
EntityUID = new Counter(r.ReadUInt32("EntityID"));
                                            
player.Account.EntityID EntityUID.Next;
                                            
using (MySqlCommand cmd2 =  new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration")
                                            .
Set("EntityID"player.Account.EntityID)
                                            .
Where("Server""COServer")) cmd2.Execute();
                                            
player.Account.Save();
                                        }
                                    }
                                }
                            }
                        }
                        else
                        {
                            
Fw.Type Forward.ForwardType.InvalidInfo;
                        }
                        if (
IPBan.IsBanned(arg3.IP))
                        {
                            
Fw.Type Forward.ForwardType.Banned;
                            
player.Send(Fw);
                            return;
                        }
                        
using (var cmd = new  MySqlCommand(MySqlCommandType.SELECT).Select("accounts").Where("Username",  player.Account.Username))
                        
using (var reader = new MySqlReader(cmd))
                            if (
reader.Read())
                                
player.Account.ServerFRW reader.ReadString("Server");
                        if (
player.Account.ServerFRW == "")
                        {
                            
player.Account.ServerFRW player.Info.Server;
                            
using (var cmd = new MySqlCommand(MySqlCommandType.UPDATE))
                                
cmd.Update("accounts").Set("Server"player.Account.ServerFRW)
                                    .
Where("Username"player.Account.Username).Execute();
                        }
                        
lock (SyncLogin)
                        {
                            if (
Fw.Type == Forward.ForwardType.Ready)
                            {
                                if (
player.Info.Server != player.Account.ServerFRW)
                                {
                                    
Fw.Type Forward.ForwardType.WrongAccount;
                                    
player.Send(Fw);
                                    return;
                                }
                                else
                                {
                                    
uint UID player.Account.EntityID;
                                    
int time Time32.Now.GetHashCode();
                                    
Fw.Identifier player.Account.GenerateKey();
                                    
Kernel.AwaitingPool[Fw.Identifier] = player.Account;
                                    
int oldValue;
                                    if (!
LoginProtection.TryGetValue(UIDout oldValue))
                                    {
                                        
LoginProtection[UID] = time;
                                        
TransferCipher transferCipher =  new TransferCipher("6D1B73DA0250473496C2845F91FA2A42",  "DDA177642131459FBFBD17D9003678A8""127.0.0.1");
                                        
uint[] encrypted =  transferCipher.Encrypt(new uint[] { player.Account.EntityID,  (uint)player.Account.State });
                                        
Fw.Identifier encrypted[0];
                                        
Fw.Identifier = (uint)encrypted[1];
                                        
Fw.IP Server.IP;
                                        
Fw.Port Server.Port;
                                        
//Console.WriteLine("{0} has been successfully transferred to server {1}! IP:[{2}].",
                                        //player.Info.Username, player.Info.Server, player.IP);
                                    
}
                                    else
                                    {
                                        if (
time oldValue TimeLimit)
                                        {
                                            
Fw.Type Forward.ForwardType.InvalidAuthenticationProtocol;
                                            
player.Send(Fw);
                                            return;
                                        }
                                        else
                                        {
                                            
TransferCipher  transferCipher = new TransferCipher("6D1B73DA0250473496C2845F91FA2A42",  "DDA177642131459FBFBD17D9003678A8""127.0.0.1");
                                            
uint[] encrypted =  transferCipher.Encrypt(new uint[] { player.Account.EntityID,  (uint)player.Account.State });
                                            
Fw.Identifier encrypted[0];
                                            
Fw.Identifier = (uint)encrypted[1];
                                            
Fw.IP Server.IP;
                                            
Fw.Port Server.Port;
                                            
Fw.Identifier player.Account.EntityID;
                                            
Kernel.TransferPool.Remove(player.Account.EntityID);
                                            
//Console.WriteLine("{0} has  been successfully transferred to server {1}! IP:[{2}].",
                                            //player.Info.Username, player.Info.Server, player.IP);
                                        
}
                                    }
                                }
                            }
                            
player.Send(Fw);
                        }
                    }
                    else
                    {
                        
Fw.Type Forward.ForwardType.ServersNotConfigured;
                        
player.Send(Fw);
                        return;
                    }
                }
            }
        } 

اعمـل كلاس اسمـو
كود PHP:

Server.cs 

وحط جواة دول

كود PHP:

using System
using System.Linq
using System.Text
using System.Threading.Tasks
using System.Collections.Generic
//Created By MrMazika 
namespace Conquer_Online_Server.Database 

    public 
unsafe class ServerInfo 
    

        public 
string Name
        public 
string IP
        public 
ushort Port
        public 
string TransferKey
        public 
string TransferSalt
    } 
    public 
unsafe class Server 
    

        public static 
Dictionary<stringServerInfoServers = new Dictionary<stringServerInfo>(); 
        public static 
void Load() 
        { 
            
using (var cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("Servers")) 
            
using (var reader cmd.CreateReader()) 
            { 
                while (
reader.Read()) 
                { 
                    
ServerInfo serverinfo = new ServerInfo(); 
                    
serverinfo.Name reader.ReadString("Name"); 
                    
serverinfo.IP reader.ReadString("IP"); 
                    
serverinfo.Port reader.ReadUInt16("Port"); 
                    
serverinfo.TransferKey reader.ReadString("TransferKey"); 
                    
serverinfo.TransferSalt reader.ReadString("TransferSalt"); 
                    
Servers.Add(serverinfo.Nameserverinfo); 
                    
string format "{0} [{1}:{2}]"
                    
Console.WriteLine(string.Format(formatserverinfo.Nameserverinfo.IPserverinfo.Port)); 
                } 
            } 
        } 
    } 


سـلآموز عفواً لايمكن عرض الروابط إلا بعد الرد على الموضوع


الساعة الآن 10:14 AM.

Powered by vpscairo
Copyright ©2013 - 2025, Jelsoft Enterprises Ltd
Translation by tamer
Copyright ©2000-2024,vpscairo.com