Register for your free account! | Forgot your password?

Go Back   elitepvpers > MMORPGs > Conquer Online 2 > CO2 Private Server > CO2 PServer Guides & Releases
You last visited: Today at 23:24

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

Advertisement



[Release] SubClass System (Current Version)

Discussion on [Release] SubClass System (Current Version) within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
[Release] SubClass System (Current Version)

Yo!!

Well... let me explain a thing, IT'S NOT FOR HELLMOUNTH SOURCE!. So don't ask me to convert or do anything like... because i won't!

let's start.

First create those enums & class:

Code:
        public enum SubClassType : byte
        {
            Switch = 0,
            Activate = 1,
            Show = 7,
            MartialPromoted = 5,
            Learn = 4
        }
        public class SubClass
        {
            public SubClassID ID;
            public byte Level;
            public byte Phase;
        }

        public enum SubClassID : byte
        {
            None = 0,
            MartialArtist = 1,
            Warlock = 2,
            ChiMaster = 3,
            Sage = 4,
            Apothecary = 5,
            Performer = 6
        }
you can create it at any place of your source.... I would say at the structures class if you have one in your source...

this are the packets:

Code:
        public static byte[] SubClass(Struct.SubClass SubClass, Struct.SubClassType Type)
        {
            byte[] Buffer = new byte[8 + 26];
            Writer.WriteUInt16((ushort)(Buffer.Length - 8), 0, Buffer);
            Writer.WriteUInt16(2320, 2, Buffer);
            Writer.WriteUInt16((ushort)Type, 4, Buffer);
            Writer.WriteByte((byte)SubClass.ID, 6, Buffer);
            Writer.WriteByte(SubClass.Level, 7, Buffer);
            Writer.WriteString(Server.MainKey, (Buffer.Length - 8), Buffer);
            return Buffer;
        }
        public static byte[] SubClassesInfo(Client CSocket, Struct.SubClassType Type)
        {
            int Position = 26;
            byte[] Buffer = new byte[8 + 26 + (CSocket.Client.SubClasses.Classes.Count * 3)];
            Writer.WriteUInt16((ushort)(Buffer.Length - 8), 0, Buffer);
            Writer.WriteUInt16(2320, 2, Buffer);
            Writer.WriteUInt16((ushort)Type, 4, Buffer);
            Writer.WriteUInt16(CSocket.Client.StudyPoints, 6, Buffer);
            Writer.WriteUInt16((ushort)CSocket.Client.SubClasses.Classes.Count, 22, Buffer);
            foreach (Struct.SubClass Class in CSocket.Client.SubClasses.Classes.Values)
            {
                Writer.WriteByte((byte)Class.ID, Position, Buffer); Position++;
                Writer.WriteByte(Class.Phase, Position, Buffer); Position++;
                Writer.WriteByte(Class.Level, Position, Buffer); Position++;
            }
            Writer.WriteString(Server.MainKey, (Buffer.Length - 8), Buffer);
            return Buffer;
        }
the first one send the little icon up the screen.... and the second send the info about all subclasses you have... so... nothing confused up to now ;D

this is my subclass class... not fully released but the important part is:

Code:
    public class Subclasses
    {
        uint mOwner = 0;
        Character Owner { get { return Server.Pool[mOwner]; } }
        public Dictionary<Struct.SubClassID, Struct.SubClass> Classes = null;
        
        public Subclasses(uint owner)
        {
            mOwner = owner;
            Classes = new Dictionary<Struct.SubClassID, Struct.SubClass>();
        }

        public void AppendNew(Struct.SubClass sClass)
        {
            if (!Classes.ContainsKey(sClass.ID))
            {
                Classes.Add(sClass.ID, sClass);
                Owner.Owner.Send(ConquerPacket.SubClass(sClass, Struct.SubClassType.Learn));
            }
        }
    }
and this is the handler:

Code:
                    #region SubClass [2320]
                    case 2320:
                        {
                            switch (Data[4])
                            {
                                #region [Restore/Switch]
                                case 0:
                                    byte To = Data[6];
                                    CSocket.Send(ConquerPacket.SubClass(new Struct.SubClass(), Struct.SubClassType.Activate));
                                    if (To > 0)//Switch
                                    {
                                        #region [Effects-Removal]
                                        switch (CSocket.Client.Active_SubClass)
                                        {
                                            case Struct.SubClassID.Apothecary:
                                                {
                                                    CSocket.Client.Object_Status.Status_Redduction[StatusRedduction.Detoxication] -= (CSocket.Client.SubClasses.Classes[Struct.SubClassID.Apothecary].Phase * 8);
                                                    break;
                                                }
                                        }
                                        #endregion
                                        #region [Effects-Addition]
                                        switch ((Struct.SubClassID)To)
                                        {
                                            case Struct.SubClassID.Apothecary:
                                                {
                                                    CSocket.Client.Object_Status.Status_Redduction[StatusRedduction.Detoxication] += (CSocket.Client.SubClasses.Classes[Struct.SubClassID.Apothecary].Phase * 8);
                                                    break;
                                                }
                                        }
                                        #endregion
                                        CSocket.Client.Active_SubClass = (Struct.SubClassID)To;
                                        CSocket.Send(ConquerPacket.SubClass(CSocket.Client.SubClasses.Classes[CSocket.Client.Active_SubClass], Struct.SubClassType.Activate));
                                        CSocket.Send(ConquerPacket.SubClassesInfo(CSocket, Struct.SubClassType.Show));
                                    }
                                    else//Restore
                                    {
                                        #region [Effects-Removal]
                                        switch (CSocket.Client.Active_SubClass)
                                        {
                                            case Struct.SubClassID.Apothecary:
                                                {
                                                    CSocket.Client.Object_Status.Status_Redduction[StatusRedduction.Detoxication] -= (CSocket.Client.SubClasses.Classes[Struct.SubClassID.Apothecary].Phase * 8);
                                                    break;
                                                }
                                        }
                                        #endregion
                                        CSocket.Client.Active_SubClass = Struct.SubClassID.None;
                                        CSocket.Send(ConquerPacket.SubClassesInfo(CSocket, Struct.SubClassType.Show));
                                    }
                                    ConquerPacket.ToLocal(CSocket.Client.Spawn, CSocket.Client.X, CSocket.Client.Y, (int)CSocket.Client.Map, 0, CSocket.Client.UID);
                                    break;
                                #endregion
                                #region [Upgrade]
                                case 2:
                                    {
                                        byte Class = Data[6];
                                        ushort Required = 0;
                                        Struct.SubClass Sc = CSocket.Client.SubClasses.Classes[(Struct.SubClassID)Class];
                                        #region [Set Required]
                                        switch (Sc.ID)
                                        {
                                            case Struct.SubClassID.MartialArtist:
                                                switch (Sc.Level)
                                                {
                                                    case 1: Required = 300; break;
                                                    case 2: Required = 900; break;
                                                    case 3: Required = 1800; break;
                                                    case 4: Required = 2700; break;
                                                    case 5: Required = 3600; break;
                                                    case 6: Required = 5100; break;
                                                    case 7: Required = 6900; break;
                                                    case 8: Required = 8700; break;
                                                    case 9: Required = ushort.MaxValue; break;
                                                }
                                                break;
                                            case Struct.SubClassID.Warlock:
                                                switch (Sc.Level)
                                                {
                                                    case 1: Required = 300; break;
                                                    case 2: Required = 900; break;
                                                    case 3: Required = 1800; break;
                                                    case 4: Required = 2700; break;
                                                    case 5: Required = 3600; break;
                                                    case 6: Required = 5100; break;
                                                    case 7: Required = 6900; break;
                                                    case 8: Required = 8700; break;
                                                    case 9: Required = ushort.MaxValue; break;
                                                }
                                                break;
                                            case Struct.SubClassID.ChiMaster:
                                                switch (Sc.Level)
                                                {
                                                    case 1: Required = 600; break;
                                                    case 2: Required = 1800; break;
                                                    case 3: Required = 3600; break;
                                                    case 4: Required = 5400; break;
                                                    case 5: Required = 7200; break;
                                                    case 6: Required = 10200; break;
                                                    case 7: Required = 13800; break;
                                                    case 8: Required = 17400; break;
                                                    case 9: Required = ushort.MaxValue; break;
                                                }
                                                break;
                                            case Struct.SubClassID.Sage:
                                                switch (Sc.Level)
                                                {
                                                    case 1: Required = 400; break;
                                                    case 2: Required = 1200; break;
                                                    case 3: Required = 2400; break;
                                                    case 4: Required = 3600; break;
                                                    case 5: Required = 4800; break;
                                                    case 6: Required = 6800; break;
                                                    case 7: Required = 9200; break;
                                                    case 8: Required = 11600; break;
                                                    case 9: Required = ushort.MaxValue; break;
                                                }
                                                break;
                                            case Struct.SubClassID.Apothecary:
                                                switch (Sc.Level)
                                                {
                                                    case 1: Required = 100; break;
                                                    case 2: Required = 200; break;
                                                    case 3: Required = 300; break;
                                                    case 4: Required = 400; break;
                                                    case 5: Required = 500; break;
                                                    case 6: Required = 1000; break;
                                                    case 7: Required = 4000; break;
                                                    case 8: Required = 9000; break;
                                                    case 9: Required = ushort.MaxValue; break;
                                                }
                                                break;
                                            case Struct.SubClassID.Performer:
                                                switch (Sc.Level)
                                                {
                                                    case 1: Required = 400; break;
                                                    case 2: Required = 1200; break;
                                                    case 3: Required = 2400; break;
                                                    case 4: Required = 3600; break;
                                                    case 5: Required = 4800; break;
                                                    case 6: Required = 6800; break;
                                                    case 7: Required = 9200; break;
                                                    case 8: Required = 11600; break;
                                                    case 9: Required = ushort.MaxValue; break;
                                                }
                                                break;
                                        }
                                        #endregion

                                        if (CSocket.Client.StudyPoints >= Required)
                                        {
                                            CSocket.Client.StudyPoints -= Required;
                                            CSocket.Client.SubClasses.Classes[(Struct.SubClassID)Class].Level++;
                                            CSocket.Send(ConquerPacket.SubClass(CSocket.Client.SubClasses.Classes[(Struct.SubClassID)Class], Struct.SubClassType.Activate));
                                            CSocket.Send(ConquerPacket.SubClassesInfo(CSocket, Struct.SubClassType.Show));
                                            Database.UpdateSubClass(CSocket.Client.SubClasses.Classes[(Struct.SubClassID)Class], CSocket.Client.UID);
                                        }
                                        break;
                                    }
                                #endregion
                                #region [Info]
                                case 6:
                                    foreach (Struct.SubClass s in CSocket.Client.SubClasses.Classes.Values)
                                    {
                                        CSocket.Send(ConquerPacket.SubClass(s, Struct.SubClassType.Learn));
                                    }
                                    CSocket.Send(ConquerPacket.SubClassesInfo(CSocket, Struct.SubClassType.Show));

                                    if (CSocket.Client.Active_SubClass != Struct.SubClassID.None)
                                        CSocket.Send(ConquerPacket.SubClass(CSocket.Client.SubClasses.Classes[CSocket.Client.Active_SubClass], Struct.SubClassType.Activate));
                                    break;
                                #endregion
                                default:
                                    Console.WriteLine("Unknown 2320 packet type " + Data[4]);
                                    Print(Data);
                                    break;
                            }
                            break;
                        }
                    #endregion
well... its nearly full and have all the necessary packets.... so i hope it to be usefull...

//Edit:
//Nearly forgot something... this are the database commands:
Code:
        public static void LoadSubClasses(Character Client)
        {
            MySqlCommand Command = new MySqlCommand(MySqlCommandType.SELECT);
            Command.Select("pt_subclass").Where("owner", Client.UID).Execute();
            MySqlReader Reader = new MySqlReader(Command);
            while (Reader.Read())
            {
                Struct.SubClass s = new Struct.SubClass();
                s.ID = (Struct.SubClassID)Reader.ReadByte("id");
                s.Level = Reader.ReadByte("level");
                s.Phase = Reader.ReadByte("phase");
                Client.SubClasses.AppendNew(s);
            }
        }

        public static void CreateSubClass(Struct.SubClass s, uint Uid)
        {
            MySqlCommand Command = new MySqlCommand(MySqlCommandType.INSERT);
            Command.Insert("pt_subclass")
                .Insert("owner", Uid)
                .Insert("id", (byte)s.ID)
                .Insert("level", s.Level)
                .Insert("phase", s.Phase)
                .Execute();            
        }

        public static void UpdateSubClass(Struct.SubClass s, uint Uid)
        {
            MySqlCommand Command = new MySqlCommand(MySqlCommandType.UPDATE);
            Command.Update("pt_subclass")
                .Set("level", s.Level)
                .Set("phase", s.Phase)
                .Where("owner", Uid)
                .And("id", (byte)s.ID)
                .Execute();
        }
some screenshots:



Cya!
12tails is offline  
Thanks
12 Users
Old 04/27/2011, 17:19   #2
 
|NeoX's Avatar
 
elite*gold: 0
Join Date: Nov 2010
Posts: 237
Received Thanks: 99
nice :O
|NeoX is offline  
Old 04/27/2011, 17:55   #3
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,225
Received Thanks: 868
If I ever get round to a highpatch source and if I do subclasses this'll defiantly help.

Thanks.
_DreadNought_ is offline  
Old 04/27/2011, 18:17   #4
 
thesamuraivega's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 125
Received Thanks: 21
so good you sourse
thesamuraivega is offline  
Old 04/27/2011, 18:37   #5
 
JobvdH's Avatar
 
elite*gold: 0
Join Date: Nov 2010
Posts: 371
Received Thanks: 120
Nice work!!
JobvdH is offline  
Old 04/27/2011, 20:03   #6
 
elite*gold: 0
Join Date: Sep 2010
Posts: 33
Received Thanks: 0
Nazzel Source Full man
Dream-war2015 is offline  
Old 04/28/2011, 01:26   #7
 
elite*gold: 0
Join Date: Mar 2011
Posts: 12
Received Thanks: 1
Do you will post yor source ???

If you have i cant foun
Arthurqwe is offline  
Old 04/28/2011, 02:12   #8
 
elite*gold: 0
Join Date: Mar 2009
Posts: 228
Received Thanks: 47
big & good work. keep it up
dego4ever is offline  
Old 04/28/2011, 02:13   #9
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
Quote:
Originally Posted by Arthurqwe View Post
Do you will post yor source ???

If you have i cant foun
nope... there is a very good example of source posted...

try hellmounth and impulse's source... they're a great base...aa and the hybrids one tough....
12tails is offline  
Old 04/28/2011, 15:54   #10
 
elite*gold: 0
Join Date: Jun 2008
Posts: 94
Received Thanks: 6
if u want his source pay him 1000 usd and i think he ill accept it =p
fotis007 is offline  
Old 04/28/2011, 17:19   #11
 
elite*gold: 0
Join Date: Mar 2011
Posts: 12
Received Thanks: 1
Quote:
Originally Posted by 12tails View Post
nope... there is a very good example of source posted...

try hellmounth and impulse's source... they're a great base...aa and the hybrids one tough....
Ty i will try the Impulse here...
Arthurqwe is offline  
Old 04/28/2011, 17:31   #12
 
_DreadNought_'s Avatar
 
elite*gold: 28
Join Date: Jun 2010
Posts: 2,225
Received Thanks: 868
Quote:
Originally Posted by fotis007 View Post
if u want his source pay him 1000 usd and i think he ill accept it =p
If he coded it and liked it alot.. If it was me I would reject the money.
_DreadNought_ is offline  
Old 04/28/2011, 18:40   #13
 
elite*gold: 0
Join Date: Sep 2010
Posts: 33
Received Thanks: 0
Quote:
Originally Posted by fotis007 View Post
if u want his source pay him 1000 usd and i think he ill accept it =p
hhhhhhhhhhhhhhh lol >>>> I Want to Free
Dream-war2015 is offline  
Old 04/29/2011, 13:10   #14
 
elite*gold: 0
Join Date: Apr 2009
Posts: 101
Received Thanks: 1
i need buy it source i ready 3000 l.E
koko20 is offline  
Old 04/29/2011, 21:34   #15
 
Sp!!ke's Avatar
 
elite*gold: 0
Join Date: Nov 2009
Posts: 380
Received Thanks: 58
Leo I can't understand ! Why you release that ??? Same question for "Guild Arsenal".


You Quit from CQ? or ....... <-- ?
Sp!!ke is offline  
Reply


Similar Threads Similar Threads
Looking for current version of S-Bot crack
06/08/2013 - Silkroad Online - 12 Replies
Hi, I was wondering if anyone knew where I can find a clean current version of S-Bot crack. Thank you in advance.
[Release] Character Events System (Any version)
05/20/2011 - CO2 PServer Guides & Releases - 7 Replies
Yo guys! I called it events cuz i mean things like Blessing, OfflineTG, Expball, Dayly Quests and many others.... well it's very simple and easy to understand. First create this class at any place of the current source you're using (i'm using a custom one self maked so i can`t give any example... sorry) public class Event_State { public string Event_Name; public uint Event_Count;
bot in current version of PW MY-EN
10/27/2010 - Perfect World - 1 Replies
hey i am looking for a working bot for current version of pw MY-EN. i cant get anywhere with any bots, i have no clue about offsets, and cant even try most of the bots, as the client name is some stuped characters which my computer doesnt even display(chinese characters i guess) any help would be appreciated : ))
SjSRO Current Version
10/25/2009 - SRO Private Server - 2 Replies
Hello, I would like to know the current version of SjSRO client needed to log in, I'm confused as v1.091 is already working, but read about people using v1.149 Please help? Thank you.



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


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.