Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Bots & Macros
You last visited: Today at 18:23

  • Please register to post and access all features, it's quick, easy and FREE!

Advertisement



Stripped ProjectAlchemy Source Code

Discussion on Stripped ProjectAlchemy Source Code within the CO2 Bots & Macros forum part of the Conquer Online 2 category.

Reply
 
Old 03/19/2011, 08:22   #1096
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
/dcplayers still working fine just tested it and logged in with no problems lol.
denominator is offline  
Old 03/19/2011, 14:54   #1097
 
elite*gold: 21
Join Date: Jul 2005
Posts: 9,193
Received Thanks: 5,380
Quote:
Originally Posted by denominator View Post
/dcplayers still working fine just tested it and logged in with no problems lol.
dcplayers doesn't require the name to be read. Dc on gms DOES require it cause it reads name and then checks for [ or ] to dc you.

Again it's a matter of shifting over the string reading by 1 whole byte... people wanting to work on this should really be able to structure their own **** packets though.
pro4never is offline  
Thanks
1 User
Old 03/19/2011, 15:18   #1098
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
Ahh thank you for clearing that up with me Never used dc on GMs with alchemy though, not needed for mining
denominator is offline  
Old 03/19/2011, 17:16   #1099
 
elite*gold: 0
Join Date: Oct 2008
Posts: 71
Received Thanks: 0
still having problems
jonathan55866 is offline  
Old 03/19/2011, 22:16   #1100
 
elite*gold: 0
Join Date: Oct 2008
Posts: 71
Received Thanks: 0
I cant figure out the 1060 error i tried everything
jonathan55866 is offline  
Old 03/19/2011, 22:26   #1101
 
elite*gold: 0
Join Date: Oct 2008
Posts: 71
Received Thanks: 0
My problem

Error:
Augh! Unknown client auth packet of type : 1060 (in the black command box)

my Auth.cs code:

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace AlchemyProxy
{
    public class AuthProtocolCryptographer
    {
        class CryptCounter
        {
            UInt16 m_Counter = 0;

            public byte Key2
            {
                get { return (byte)(m_Counter >> 8); }
            }

            public byte Key1
            {
                get { return (byte)(m_Counter & 0xFF); }
            }

            public void Increment()
            {
                m_Counter++;
            }
        }

        private CryptCounter _decryptCounter;
        private CryptCounter _encryptCounter;
        private byte[] _cryptKey1;
        private byte[] _cryptKey2;

        public AuthProtocolCryptographer()
        {
            _decryptCounter = new CryptCounter();
            _encryptCounter = new CryptCounter();
            _cryptKey1 = new byte[0x100];
            _cryptKey2 = new byte[0x100];
            byte i_key1 = 0x9D;
            byte i_key2 = 0x62;
            for (int i = 0; i < 0x100; i++)
            {
                _cryptKey1[i] = i_key1;
                _cryptKey2[i] = i_key2;
                i_key1 = (byte)((0x0F + (byte)(i_key1 * 0xFA)) * i_key1 + 0x13);
                i_key2 = (byte)((0x79 - (byte)(i_key2 * 0x5C)) * i_key2 + 0x6D);
            }
        }

        public void Decrypt(byte[] buffer)
        {
            for (int i = 0; i < buffer.Length; i++)
            {
                buffer[i] ^= (byte)0xAB;
                buffer[i] = (byte)(buffer[i] >> 4 | buffer[i] << 4);
                buffer[i] ^= (byte)(_cryptKey1[_decryptCounter.Key1] ^ _cryptKey2[_decryptCounter.Key2]);
                _decryptCounter.Increment();
            }
        }
        public void Encrypt(byte[] buffer)
        {
            for (int i = 0; i < buffer.Length; i++)
            {
                buffer[i] ^= (byte)0xAB;
                buffer[i] = (byte)(buffer[i] >> 4 | buffer[i] << 4);
                buffer[i] ^= (byte)(_cryptKey1[_encryptCounter.Key1] ^ _cryptKey2[_encryptCounter.Key2]);
                _encryptCounter.Increment();
            }
        }

        public void EncryptBackwards(byte[] buffer)
        {
            for (int i = 0; i < buffer.Length; i++)
            {
                buffer[i] ^= (byte)(_cryptKey2[_encryptCounter.Key2] ^ _cryptKey1[_encryptCounter.Key1]);
                buffer[i] = (byte)(buffer[i] >> 4 | buffer[i] << 4);
                buffer[i] ^= (byte)0xAB;

                _encryptCounter.Increment();
            }
        }
        public void DecryptBackwards(byte[] buffer)
        {
            for (int i = 0; i < buffer.Length; i++)
            {
                buffer[i] ^= (byte)(_cryptKey2[_decryptCounter.Key2] ^ _cryptKey1[_decryptCounter.Key1]);
                buffer[i] = (byte)(buffer[i] >> 4 | buffer[i] << 4);
                buffer[i] ^= (byte)0xAB;

                _decryptCounter.Increment();
            }
        }

        public void GenerateKeys(UInt32 CryptoKey, UInt32 AccountID)
        {
            UInt32 tmpkey1 = 0, tmpkey2 = 0;
            tmpkey1 = ((CryptoKey + AccountID) ^ (0x4321)) ^ CryptoKey;
            tmpkey2 = tmpkey1 * tmpkey1;

            for (int i = 0; i < 256; i++)
            {
                int right = ((3 - (i % 4)) * 8);
                int left = ((i % 4)) * 8 + right;
                _cryptKey1[i] ^= (byte)(tmpkey1 << right >> left);
                _cryptKey2[i] ^= (byte)(tmpkey2 << right >> left);
            }
        }
    }
}
LoaderSet:

Code:
[Loader]
IPAddress= my hammachi IP
LoginPort=5002
GamePort=5000
Bot Settings

Code:
IP= my hammachi IP
USERNAME=root
PASSWORD=password
DATABASE=my database
Program.cs

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using OpenSSL;
using System.IO;
using System.Threading;
using DMapLoader;
using System.Collections;
using System.Windows.Forms;

namespace AlchemyProxy
{
   /// <summary>
   /// This proxy is created and released by Pro4Never exclusively on Epvp.
   /// Credits:
   /// Tannel: Blowfish, Packet reader (which I no longer use) and some of the packets. 
   /// Impulse: Encryption, packet writer, SQL wrapper, TONS of little things i picked up from his source
   /// Immune: Implimentation of password decryption, sql wrapper and some other cool stuff I learned + all his great help!
   /// Null: Lots of help when I was first trying to work on a proxy
   /// Korv: Dmap reader. <3 it!
   /// 
   /// The proxy in it's current state is not exactly stable, it's just a stripped down version of what I was hosting
   /// I don't suggest using it other than for a slightly less messy example or for packet logging.
   /// Feel free to release botting functionality for it. I specifically removed any botting from it to force
   /// people to actually do some work. 
   /// 
   /// I left all the packets and packet handling in there so you should have a great start!
   /// 
   /// NOTE: Do not re-release this claiming it as your own work. Release whatever you want for it but don't
   /// claim that you made it, that's just stupid.
   /// </summary>
           
  
    class Program
    {
        public static bool WRite(string T)
        {
            Console.WriteLine(T);
            return true;
        }
        public static void COut(string Out)
        {
            Console.WriteLine(Program.ProxyTitle + " " + Out);
        }       
       
        public static int Offset = 4;
        public static List<Location> NpcLocations = new List<Location>();
        public static ArrayList MoneyIDs = new ArrayList() { (uint)1090020, (uint)1091000, (uint)1091010, (uint)1091020 };
        public static ArrayList AreaTargets = new ArrayList() { (uint)8001,3090 , 1120};
        public static ArrayList SelfTargets = new ArrayList() { 4000, 1190, 4060, 4070, 4050, 4010, 4020 };
       
        public static Dictionary<ushort, ushort> DynaMaps = new Dictionary<ushort, ushort>();
        public static System.Random Rand = new System.Random();
        public static string AuthIp = "my hammachi IP";
        public static string ProxyTitle = "[ProjectAlchemy]";
        public static string Version = "v1.1";
        public static string Username = "root";
        public static string Password = "my password";
        public static string Host = "my database";
        public static DMapServer DmapHandler = new DMapServer();
        public static Dictionary<ushort, Ending> PortBindings = new Dictionary<ushort, Ending>();
        public static ushort AuthPort = 9960;
        public static string ProxyIp = "my hammachi IP";
        public static string GameKey = "DR654dt34trg4UI6";
        public static string GameIp = "";
        public static ushort GamePort = 5000;
        public static bool Debug = false;           
        public static Dictionary<Socket, LoginClient> LoginClients = new Dictionary<Socket, LoginClient>();
        public static Dictionary<Socket, Client> GameClients = new Dictionary<Socket, Client>();
        public static Dictionary<uint, LoginClient> AuthdClients = new Dictionary<uint, LoginClient>();
        public static GUI GuiForm;
        public static Thread GuiThread;
        public static ushort TotalOnline = 0;
        static void Main(string[] args)
        {
            try
            {               
                Control.CheckForIllegalCrossThreadCalls = false;                             
                #region Initialize MySql
                Database.LoadSettings();
                MySqlHandler.MySqlArgument arg = new MySqlHandler.MySqlArgument();
                arg.User = Username;
                arg.Password = Password;
                arg.Host = "localhost";
                arg.Database = Host;
                MySqlHandler.Connections.Open(arg);
                MySqlHandler.MySqlCommandHandler.TurnOn();
                #endregion
                DmapHandler.ConquerPath = Application.StartupPath + @"\map\";
                DmapHandler.Load(true);
                PortBindings.Add(5001, new Ending(AuthIp, 9960));
                PortBindings.Add(5002, new Ending(AuthIp, 9960));
                PortBindings.Add(5003, new Ending(AuthIp, 9960));         
     
                ///this is setting up all the listeners! If you want to setup international support add in custom ending ip/ports!
                foreach (KeyValuePair<ushort, Ending> Listener in PortBindings)
                {
                    try
                    {
                        WinSocket AuthSocket = new WinSocket(Listener.Value.IP, Listener.Key, Listener.Value.Port);
                        AuthSocket.AnnounceNewConnection += new Action<Wrapper>(AuthSocket_AnnounceNewConnection);
                        AuthSocket.AnnounceReceive += new Action<byte[], Wrapper, byte[]>(AuthSocket_AnnounceReceive);
                        AuthSocket.AnnounceDisconnection += new Action<Wrapper>(AuthSocket_AnnounceDisconnection);
                    }
                    catch { COut("Failed to start auth listener. InternalPort: " + Listener.Key + " ExternalPort: " + Listener.Value); }
                }
                try
                {
                    WinSocket GameSocket = new WinSocket(GameIp, 5000, GamePort);
                    GameSocket.AnnounceNewConnection += new Action<Wrapper>(GameSocket_AnnounceNewConnection);
                    GameSocket.AnnounceReceive += new Action<byte[], Wrapper, byte[]>(GameSocket_AnnounceReceive);
                    GameSocket.AnnounceDisconnection += new Action<Wrapper>(GameSocket_AnnounceDisconnection);
                }
                catch { }
                Thread Wha = new Thread((new Updates()).Run);
                Wha.Start();              
                COut("Ready to accept connections!");
                GuiThread = new Thread(GuiRun);
                GuiThread.Start();
                while (true)
                {
                    Print(Console.ReadLine());
                    Thread.Sleep(10);
                }
            }
            catch { }
            
        }
        public static void GuiRun()
        {
            try
            {
                GuiForm = new GUI();
                Application.Run(GuiForm);
                while (true)
                    Thread.Sleep(500);
            }
            catch { }
        }
        public static void Print(string What)
        {
            try
            {
                lock (GameClients)
                {
                    foreach (Client C in GameClients.Values)
                    {
                        Handler.Chat(C, "[ProjectAlchemy] " + What, 2000);
                    }
                }
            }
            catch { }
        }
        static void GameSocket_AnnounceDisconnection(Wrapper obj)
        {
            try
            {
                Client C = obj.connector as Client;
                C.Disconnect();
                GuiForm.OutOnline.Text = Convert.ToString(GameClients.Count);
            }
            catch { }
        }
        static void SetUpCrypto(Client C)
        {
            try
            {
                BigNumber RealClientPublicKey = BigNumber.FromHexString(C.ClientDataDHP.Client_PubKey);
                BigNumber RealServerPublicKey = BigNumber.FromHexString(C.ServerDataDHP.Server_PubKey);

                GameCrypto ClientCrypto = new GameCrypto((C.ClientCrypt).DH.ComputeKey(RealServerPublicKey));
                GameCrypto ServerCrypto = new GameCrypto((C.ServerCrypt).DH.ComputeKey(RealClientPublicKey));

                ClientCrypto.Blowfish.EncryptIV = C.ServerDataDHP.ClientIV;
                ClientCrypto.Blowfish.DecryptIV = C.ServerDataDHP.ServerIV;

                ServerCrypto.Blowfish.EncryptIV = C.ServerDataDHP.ServerIV;
                ServerCrypto.Blowfish.DecryptIV = C.ServerDataDHP.ClientIV;

                C.ClientCrypt = ClientCrypto;
                C.ServerCrypt = ServerCrypto;
                C.Exchanging = false;
            }
            catch { }
        }
        static void GameSocket_AnnounceReceive(byte[] Data, Wrapper arg2, byte[] arg3)
        {

            try
            {      
                Client C = arg2.connector as Client;
                C.ServerCrypt.Decrypt(Data);
                if (C.Exchanging && Data.Length > 36)
                {
                    C.ClientDataDHP = new ClientDHPacket(Data);
                    C.ClientDataDHP.Edit(Data, C.ClientCrypt.DH.PublicKey.ToHexString());
                    C.ToServerQueue.Enqueue(Data);
                    SetUpCrypto(C); 
                }
                else
                {
                    Packets.SplitClient(Data, C); 
                }
            }
            catch { }
        }
        

        static void GameSocket_AnnounceNewConnection(Wrapper C)
        {
            try
            {
                if (GameClients.ContainsKey(C._socket))
                {
                    GameClients[C._socket].Disconnect();
                    GameClients.Remove(C._socket);
                }
                C.connector = new Client(C._socket, C._Port);
                GameClients.Add(C._socket, (Client)C.connector);
                GuiForm.OutOnline.Text = Convert.ToString(GameClients.Count);
            }
            catch { }
        }      
        static void AuthSocket_AnnounceDisconnection(Wrapper C)
        {
            try { ((LoginClient)C.connector).Disconnect(); }
            catch { }
        }

        static void AuthSocket_AnnounceReceive(byte[] arg1, Wrapper C, byte[] arg3)
        {
            try
            {
                LoginClient Sender = C.connector as LoginClient;
                Handler.AuthCliPacket(arg1, Sender);
            }
            catch { }
        }

        static void AuthSocket_AnnounceNewConnection(Wrapper C)
        {
            try
            {
                if (LoginClients.ContainsKey(C._socket))
                {
                    LoginClients[C._socket].Disconnect();
                    LoginClients.Remove(C._socket);
                }                
                    C.connector = new LoginClient(C._socket, C._Port);
                    LoginClients.Add(C._socket, (LoginClient)C.connector);               
            }
            catch { }
        }

    }
    public enum Effect : ulong
    {        
        Cyclone = 8388608,
        //I don't feel like spelling them all out for you... trial and error!
    }
    public enum Update : uint
    {
        HP = 0,
        Mana = 2,
        Money = 4,
        PkPt = 6,
        Job = 7,
        Stam = 8,
        Stats = 10,
        Mesh = 11,
        Level = 12,
        Spirit = 13,
        Vitality = 14,
        Strength = 15,
        Agility = 16,
        StatusEffect = 25,
        Hair = 26,
        XPPct = 27,
        CP = 29,
        BonusBP = 44,
        BoundCp = 45
    }public struct Location
    {
       public ushort X, Y, Map;
    }
    public class Ending
    {
        public string IP;
        public ushort Port;
        public Ending(string ToIP, ushort Toport)
        {
            this.IP = ToIP;
            this.Port = Toport;
        }
    }
    class Updates
    {
        public void Run()
        {
            while (true)
            {
                try
                {

                    lock (Program.AuthdClients)
                    {
                        List<uint> Removal = new List<uint>();
                        foreach (LoginClient Cl in Program.AuthdClients.Values)
                        {
                            if (DateTime.Now > Cl.Authd.AddSeconds(30))
                                Removal.Add(Cl.UID);
                        }
                        foreach (uint I in Removal)
                        {
                            Program.AuthdClients.Remove(I);
                        }
                        Removal = null;
                    }

                    lock (Program.GameClients)
                    {
                        List<DontPick> Removal = new List<DontPick>();

                        foreach (Client C in Program.GameClients.Values)
                        {
                            foreach (DontPick I in C.Dropped)
                            {
                                if (DateTime.Now > I.Added.AddSeconds(60))
                                    Removal.Add(I);
                            }
                        }
                        foreach (DontPick I in Removal)
                        {
                            I.Owner.DoNotPick.Remove(I.UID);
                            I.Owner.Dropped.Remove(I);
                        }
                        Removal = null;
                    }
                }
                catch { }
                Thread.Sleep(1000);
            }
        }
    }
}
jonathan55866 is offline  
Old 03/19/2011, 22:37   #1102
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
Quote:
public static string AuthIp = "my hammachi IP";
?!?!?! Shouldn`t change that >.< Put it back to "208.96.34.46"

Quote:
default:
Console.WriteLine("Augh! Unknown client auth packet of type: " + type);
break;
That`s in AuthHandle.cs in the Packet folder and not in auth.cs? I might be wrong but I`m assuming that p4n said about UpdateEntity which from what I can find is in Packet folder where the packets are?

P4n please correct me if I`m wrong. I`m not exactly a coder as you know but I`m sure you said about UpdateEntity?
denominator is offline  
Old 03/19/2011, 22:42   #1103
 
elite*gold: 0
Join Date: Oct 2008
Posts: 71
Received Thanks: 0
Okay one sec btw i just have it on my desktop is that okay??
jonathan55866 is offline  
Old 03/19/2011, 22:51   #1104
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
You can have it anywhere you want in your computer lol.

When I had a problem I just deleted Conquer and reinstalled Conquer and voila it worked again.
denominator is offline  
Old 03/19/2011, 22:55   #1105
 
elite*gold: 0
Join Date: Oct 2008
Posts: 71
Received Thanks: 0
It used to show the loading bar and ALMOST log-in
now it just says server maint please re log but WONT log-in dont even show the loading bar
once i changed auth ip too 208.96.34.46

I am trying Gem World, Emerald
and nothing is registering in the black command box.
jonathan55866 is offline  
Old 03/19/2011, 23:05   #1106
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
Well I have no idea what you have played around with but I`m still using the ORIGINAL alchemy source code that p4n originally posted and it STILL loads up with no problems? I just had to test it to see if mine would do the same but nope it loaded up first time on Dreams servers with no problem. You also know that you MIGHT have to try to log in more than five times before it will actually load o.0? This has been stated time and time again through this thread.

I also just loaded up the GemWorld servers and it asked me to create a character, again I have no idea what you have played around with but if you`re not sure about what you are doing then you should just leave it and stick with what people have already given in this thread such as hunting/looting/mining/pathfinding codes.
denominator is offline  
Old 03/19/2011, 23:07   #1107
 
elite*gold: 0
Join Date: Oct 2008
Posts: 71
Received Thanks: 0
can you upload that for me, that's the one i had before then my PC got messed up that worked for me, this one just isn't working at all you can even PC me the link
jonathan55866 is offline  
Old 03/19/2011, 23:17   #1108
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
You have also changed your authport and gameport >.<

Code:
        public static ushort AuthPort = 9959;
        public static string ProxyIp = "Your Hamachi IP";
        public static string GameKey = "DR654dt34trg4UI6";
        public static string GameIp = "";
        public static ushort GamePort = 5816;
Change it back to that! You should change only two things in there and that`s your password for the sql database (alchemy database which will probably be either root or test or something like that) and the only other thing you change is the ProxyIp to your Hamachi number and nothing else needs to be changed in there.

I also get the augh thing come up but I am just using it for mining so it`s not a big deal for me.

Here is my program.cs

Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Net.Sockets;
using OpenSSL;
using System.IO;
using System.Threading;
using DMapLoader;
using System.Collections;
using System.Windows.Forms;

namespace AlchemyProxy
{
   /// <summary>
   /// This proxy is created and released by Pro4Never exclusively on Epvp.
   /// Credits:
   /// Tannel: Blowfish, Packet reader (which I no longer use) and some of the packets. 
   /// Impulse: Encryption, packet writer, SQL wrapper, TONS of little things i picked up from his source
   /// Immune: Implimentation of password decryption, sql wrapper and some other cool stuff I learned + all his great help!
   /// Null: Lots of help when I was first trying to work on a proxy
   /// Korv: Dmap reader. <3 it!
   /// 
   /// The proxy in it's current state is not exactly stable, it's just a stripped down version of what I was hosting
   /// I don't suggest using it other than for a slightly less messy example or for packet logging.
   /// Feel free to release botting functionality for it. I specifically removed any botting from it to force
   /// people to actually do some work. 
   /// 
   /// I left all the packets and packet handling in there so you should have a great start!
   /// 
   /// NOTE: Do not re-release this claiming it as your own work. Release whatever you want for it but don't
   /// claim that you made it, that's just stupid.
   /// </summary>
           
  
    class Program
    {
        public static bool WRite(string T)
        {
            Console.WriteLine(T);
            return true;
        }
        public static void COut(string Out)
        {
            Console.WriteLine(Program.ProxyTitle + " " + Out);
        }       
       
        public static int Offset = 4;
        public static List<Location> NpcLocations = new List<Location>();
        public static ArrayList RareItems = new ArrayList() { (uint)1088000, (uint)1088001 };
        public static ArrayList MoneyIDs = new ArrayList() { (uint)1090020, (uint)1091000, (uint)1091010, (uint)1091020 };
        public static ArrayList AreaTargets = new ArrayList() { (uint)8001,3090 , 1120};
        public static ArrayList SelfTargets = new ArrayList() { 4000, 1190, 4060, 4070, 4050, 4010, 4020 };
       
        public static Dictionary<ushort, ushort> DynaMaps = new Dictionary<ushort, ushort>();
        public static System.Random Rand = new System.Random();
        public static string AuthIp = "208.96.34.46";
        public static string ProxyTitle = "[ProjectAlchemy]";
        public static string Version = "v1.1";
        public static string Username = "root";
        public static string Password = "mypassword";
        public static string Host = "alchemy";
        public static DMapServer DmapHandler = new DMapServer();
        public static Dictionary<ushort, Ending> PortBindings = new Dictionary<ushort, Ending>();
        public static ushort AuthPort = 9959;
        public static string ProxyIp = "my Hamachi/internalIP";
        public static string GameKey = "DR654dt34trg4UI6";
        public static string GameIp = "";
        public static ushort GamePort = 5816;
        public static bool Debug = false;           
        public static Dictionary<Socket, LoginClient> LoginClients = new Dictionary<Socket, LoginClient>();
        public static Dictionary<Socket, Client> GameClients = new Dictionary<Socket, Client>();
        public static Dictionary<uint, LoginClient> AuthdClients = new Dictionary<uint, LoginClient>();
        public static GUI GuiForm;
        public static Thread GuiThread;
        public static ushort TotalOnline = 0;
        static void Main(string[] args)
        {
            try
            {               
                Control.CheckForIllegalCrossThreadCalls = false;                             
                #region Initialize MySql
                Database.LoadSettings();
                MySqlHandler.MySqlArgument arg = new MySqlHandler.MySqlArgument();
                arg.User = Username;
                arg.Password = Password;
                arg.Host = "localhost";
                arg.Database = Host;
                MySqlHandler.Connections.Open(arg);
                MySqlHandler.MySqlCommandHandler.TurnOn();
                #endregion
                DmapHandler.ConquerPath = Application.StartupPath + @"\map\";
                DmapHandler.Load(true);
                PortBindings.Add(5001, new Ending(AuthIp, 9959));
                PortBindings.Add(5002, new Ending(AuthIp, 9960));
                PortBindings.Add(5003, new Ending(AuthIp, 9958));         
     
                ///this is setting up all the listeners! If you want to setup international support add in custom ending ip/ports!
                foreach (KeyValuePair<ushort, Ending> Listener in PortBindings)
                {
                    try
                    {
                        WinSocket AuthSocket = new WinSocket(Listener.Value.IP, Listener.Key, Listener.Value.Port);
                        AuthSocket.AnnounceNewConnection += new Action<Wrapper>(AuthSocket_AnnounceNewConnection);
                        AuthSocket.AnnounceReceive += new Action<byte[], Wrapper, byte[]>(AuthSocket_AnnounceReceive);
                        AuthSocket.AnnounceDisconnection += new Action<Wrapper>(AuthSocket_AnnounceDisconnection);
                    }
                    catch { COut("Failed to start auth listener. InternalPort: " + Listener.Key + " ExternalPort: " + Listener.Value); }
                }
                try
                {
                    WinSocket GameSocket = new WinSocket(GameIp, 5000, GamePort);
                    GameSocket.AnnounceNewConnection += new Action<Wrapper>(GameSocket_AnnounceNewConnection);
                    GameSocket.AnnounceReceive += new Action<byte[], Wrapper, byte[]>(GameSocket_AnnounceReceive);
                    GameSocket.AnnounceDisconnection += new Action<Wrapper>(GameSocket_AnnounceDisconnection);
                }
                catch { }
                Thread Wha = new Thread((new Updates()).Run);
                Wha.Start();              
                COut("Ready to accept connections!");
                GuiThread = new Thread(GuiRun);
                GuiThread.Start();
                while (true)
                {
                    Print(Console.ReadLine());
                    Thread.Sleep(10);
                }
            }
            catch { }
            
        }
        public static void GuiRun()
        {
            try
            {
                GuiForm = new GUI();
                Application.Run(GuiForm);
                while (true)
                    Thread.Sleep(500);
            }
            catch { }
        }
        public static void Print(string What)
        {
            try
            {
                lock (GameClients)
                {
                    foreach (Client C in GameClients.Values)
                    {
                        Handler.Chat(C, "[ProjectAlchemy] " + What, 2000);
                    }
                }
            }
            catch { }
        }
        static void GameSocket_AnnounceDisconnection(Wrapper obj)
        {
            try
            {
                Client C = obj.connector as Client;
                C.Disconnect();
                GuiForm.OutOnline.Text = Convert.ToString(GameClients.Count);
            }
            catch { }
        }
        static void SetUpCrypto(Client C)
        {
            try
            {
                BigNumber RealClientPublicKey = BigNumber.FromHexString(C.ClientDataDHP.Client_PubKey);
                BigNumber RealServerPublicKey = BigNumber.FromHexString(C.ServerDataDHP.Server_PubKey);

                GameCrypto ClientCrypto = new GameCrypto((C.ClientCrypt).DH.ComputeKey(RealServerPublicKey));
                GameCrypto ServerCrypto = new GameCrypto((C.ServerCrypt).DH.ComputeKey(RealClientPublicKey));

                ClientCrypto.Blowfish.EncryptIV = C.ServerDataDHP.ClientIV;
                ClientCrypto.Blowfish.DecryptIV = C.ServerDataDHP.ServerIV;

                ServerCrypto.Blowfish.EncryptIV = C.ServerDataDHP.ServerIV;
                ServerCrypto.Blowfish.DecryptIV = C.ServerDataDHP.ClientIV;

                C.ClientCrypt = ClientCrypto;
                C.ServerCrypt = ServerCrypto;
                C.Exchanging = false;
            }
            catch { }
        }
        static void GameSocket_AnnounceReceive(byte[] Data, Wrapper arg2, byte[] arg3)
        {

            try
            {      
                Client C = arg2.connector as Client;
                C.ServerCrypt.Decrypt(Data);
                if (C.Exchanging && Data.Length > 36)
                {
                    C.ClientDataDHP = new ClientDHPacket(Data);
                    C.ClientDataDHP.Edit(Data, C.ClientCrypt.DH.PublicKey.ToHexString());
                    C.ToServerQueue.Enqueue(Data);
                    SetUpCrypto(C); 
                }
                else
                {
                    Packets.SplitClient(Data, C); 
                }
            }
            catch { }
        }
        

        static void GameSocket_AnnounceNewConnection(Wrapper C)
        {
            try
            {
                if (GameClients.ContainsKey(C._socket))
                {
                    GameClients[C._socket].Disconnect();
                    GameClients.Remove(C._socket);
                }
                C.connector = new Client(C._socket, C._Port);
                GameClients.Add(C._socket, (Client)C.connector);
                GuiForm.OutOnline.Text = Convert.ToString(GameClients.Count);
            }
            catch { }
        }      
        static void AuthSocket_AnnounceDisconnection(Wrapper C)
        {
            try { ((LoginClient)C.connector).Disconnect(); }
            catch { }
        }

        static void AuthSocket_AnnounceReceive(byte[] arg1, Wrapper C, byte[] arg3)
        {
            try
            {
                LoginClient Sender = C.connector as LoginClient;
                Handler.AuthCliPacket(arg1, Sender);
            }
            catch { }
        }

        static void AuthSocket_AnnounceNewConnection(Wrapper C)
        {
            try
            {
                if (LoginClients.ContainsKey(C._socket))
                {
                    LoginClients[C._socket].Disconnect();
                    LoginClients.Remove(C._socket);
                }                
                    C.connector = new LoginClient(C._socket, C._Port);
                    LoginClients.Add(C._socket, (LoginClient)C.connector);               
            }
            catch { }
        }

    }
    public enum Effect : ulong
    {        
        Cyclone = 8388608,
        //I don't feel like spelling them all out for you... trial and error!
    }
    public enum Update : uint
    {
        HP = 0,
        Mana = 2,
        Money = 4,
        PkPt = 6,
        Job = 7,
        Stam = 8,
        Stats = 10,
        Mesh = 11,
        Level = 12,
        Spirit = 13,
        Vitality = 14,
        Strength = 15,
        Agility = 16,
        StatusEffect = 25,
        Hair = 26,
        XPPct = 27,
        CP = 29,
        BonusBP = 44,
        BoundCp = 45
    }public struct Location
    {
       public ushort X, Y, Map;
    }
    public class Ending
    {
        public string IP;
        public ushort Port;
        public Ending(string ToIP, ushort Toport)
        {
            this.IP = ToIP;
            this.Port = Toport;
        }
    }
    class Updates
    {
        public void Run()
        {
            while (true)
            {
                try
                {

                    lock (Program.AuthdClients)
                    {
                        List<uint> Removal = new List<uint>();
                        foreach (LoginClient Cl in Program.AuthdClients.Values)
                        {
                            if (DateTime.Now > Cl.Authd.AddSeconds(30))
                                Removal.Add(Cl.UID);
                        }
                        foreach (uint I in Removal)
                        {
                            Program.AuthdClients.Remove(I);
                        }
                        Removal = null;
                    }

                    lock (Program.GameClients)
                    {
                        List<DontPick> Removal = new List<DontPick>();

                        foreach (Client C in Program.GameClients.Values)
                        {
                            foreach (DontPick I in C.Dropped)
                            {
                                if (DateTime.Now > I.Added.AddSeconds(60))
                                    Removal.Add(I);
                            }
                        }
                        foreach (DontPick I in Removal)
                        {
                            I.Owner.DoNotPick.Remove(I.UID);
                            I.Owner.Dropped.Remove(I);
                        }
                        Removal = null;
                    }
                }
                catch { }
                Thread.Sleep(1000);
            }
        }
    }
}
denominator is offline  
Old 03/19/2011, 23:27   #1109
 
elite*gold: 0
Join Date: Oct 2008
Posts: 71
Received Thanks: 0
when i made a new database it was called alchemy so wouldnt i just leave it?

like the stuff when i first did appserver was root but the NEW database in localhost is alchemy
jonathan55866 is offline  
Old 03/19/2011, 23:35   #1110
 
elite*gold: 0
Join Date: Aug 2010
Posts: 951
Received Thanks: 76
Don`t think me rude but do you have any idea what you are doing with this?

Once your database is created that`s pretty much it you never really need to mess with the database again, it`s just there to show which characters are registered to your proxy. I use xampp rather than appserver but I assume the principal is exactly the same. Create a database called alchemy then upload the sql file to that database and that`s it done never needs to be messed with again.
denominator is offline  
Reply


Similar Threads Similar Threads
[RELEASE(SOURCE CODE)]-- KabBOT2 v1 Full Source(vb6)
10/07/2011 - Dekaron Exploits, Hacks, Bots, Tools & Macros - 106 Replies
I've been meaning to post this for awhile but I pretty much forgot about it. I've been getting quite a few requests for it so I decided to finally get around to posting it. #1. So here you go, Just have or Download Visual Basic 6, you need to update it to VbRuntime 6 Service Pack 6. #2. Run the file name KabBOT.vbp. #3. Enjoy. 100% Virus Free VirusTotal.com report. VirusTotal - Free Online Virus, Malware and URL Scanner
[RELEASE] [OPEN SOURCE] CE 5.5 Pointer to AutoIt Source-Code
02/13/2011 - AutoIt - 6 Replies
Habe heute erst gemerkt, dass es hier eine AutoIt Sektion gibt xD also poste ich mal mein Programm mit rein. Funktionsweise: 1. in CE Rechtsklick auf den Pointer und auf "Copy" klicken 2. in meinem Programm auf "Code generieren" klicken 3. In euer Scite gehen und einfügen Hier ist der Source Code vom Programm:



All times are GMT +1. The time now is 18:23.


Powered by vBulletin®
Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.
SEO by vBSEO ©2011, Crawlability, Inc.
This site is protected by reCAPTCHA and the Google Privacy Policy and Terms of Service apply.

Support | Contact Us | FAQ | Advertising | Privacy Policy | Terms of Service | Abuse
Copyright ©2025 elitepvpers All Rights Reserved.