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 20:01

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

Advertisement



[Release]INI save system for 12tail's flowers!

Discussion on [Release]INI save system for 12tail's flowers! within the CO2 PServer Guides & Releases forum part of the CO2 Private Server category.

Reply
 
Old   #1
 
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
[Release]INI save system for 12tail's flowers!

OK, this save system works, but you have to get the actually flower system working(like me).

First in your C:\OldCODB\ folder, make a NEW FOLDER called "Flowers" (without the quotes)

Then...

Find in Database.cs:
Code:
public static Game.Character LoadCharacter(string Name, ref string Account)
and above that add:

Then go down in the LoadCharacter void until you find this near this bottom:
Code:
}
                    catch (Exception ex) { Console.WriteLine(ex.ToString()); }
                    FS.Flush();
                    BR.Close();
                    FS.Close();
                    C.Loaded = true;
Above that }, add:
Code:
LoadFlowerRank(Name);
Next, find:
Code:
public static string CreateCharacter(string Account, string Name, ushort Body, byte Job)
Replace:
Code:
FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + Name + ".chr", FileMode.CreateNew);
BinaryWriter BW = new BinaryWriter(FS);
With:
Code:
FileStream FS = new FileStream(@"C:\OldCODB\Users\Characters\" + Name + ".chr", FileMode.CreateNew);
                        FileStream FS2 = new FileStream(@"C:\OldCODB\Flowers\" + Name + ".chr", FileMode.CreateNew);
                        BinaryWriter BW = new BinaryWriter(FS);
                        BinaryWriter BW2 = new BinaryWriter(FS2);

                        BW2.Write((int)0);//RedRoses
                        BW2.Write((int)0);//RedRoses2day
                        BW2.Write((int)0);//Lilies
                        BW2.Write((int)0);//Lilies2day
                        BW2.Write((int)0);//Tulips
                        BW2.Write((int)0);//Tulips2day
                        BW2.Write((int)0);//Orchads
                        BW2.Write((int)0);//Orchads2day
                        BW2.Flush();
                        FS2.Flush();
                        BW2.Close();
                        FS2.Close();
Lastly, find:
Code:
public static void SaveCharacter(Game.Character C, string Acc)
Find this near the bottom:
Code:
BW.Flush();
                FS.Flush();
                BW.Close();
                FS.Close();
And below it add:
Code:
SaveFlowerRank(C);
There, all done.

NOTE:

If you get this error:
Code:
NewestCoServer.Character does not contain a definition for FlowerName
Above this is Character.cs:
Code:
public Struct.Flowers Flowers;
Add:
Code:
public string FlowerName = "";
walmartboi is offline  
Thanks
11 Users
Old 02/23/2010, 22:46   #2
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 210
awesome! this was/is really helpful for me! and for other people! +Kkkkkkk from me! and 1k cookies for u XD!

newbie question but I get 1 error...

"NewestCoServer.Character does not contain a definition for FlowerName"

What should I put it Character.cs XD?
killersub is offline  
Old 02/23/2010, 22:48   #3
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
gj
copz1337 is offline  
Old 02/23/2010, 22:48   #4
 
elite*gold: 20
Join Date: Jan 2008
Posts: 2,338
Received Thanks: 490
good job
~Yuki~ is offline  
Old 02/23/2010, 22:50   #5
 
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
Quote:
Originally Posted by killersub View Post
awesome! this was/is really helpful for me! and for other people! +Kkkkkkk from me! and 1k cookies for u XD!

newbie question but I get 1 error...

"NewestCoServer.Character does not contain a definition for FlowerName"

What should I put it Character.cs XD?
#Added fix to main post.
walmartboi is offline  
Thanks
1 User
Old 02/23/2010, 22:54   #6
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
This is the Working System,

In Features Make a File Name Flowers.cs And Add

Code:
using System;
using System.Collections.Generic;
using System.Text;
using NewestCOServer.Game;
namespace NewestCOServer
{
    public class Flowers
    {
        public static void Handle(Main.GameClient GC, byte[] Data)
        {
            #region Target
            string ID = "";
            for (byte x = 18; x < 25; x++)
            {
                ID += Convert.ToChar(Data[x]).ToString();
            }

            uint TargetID = uint.Parse(ID);
            Character SaveChar = (Character)World.H_Chars[TargetID];
            //GC.LocalMessage(2005, "Sending to target id: " + TargetID);//test : D
            #endregion
            #region Type
            string Typing = "";
            for (byte x = 25; x < 32; x++)
            {
                Typing += Convert.ToChar(Data[x]).ToString();
            }
            string[] SplitValue = Typing.Split(' ');

            int Flowers = int.Parse(SplitValue[1]);
            int Type = int.Parse(SplitValue[2]);
            #endregion

            if (GC.MyChar.Body == 2001 || GC.MyChar.Body == 2002)
            { GC.LocalMessage(2005, "You can't send flowers"); return; }

            if (World.H_Chars.Contains(TargetID))
            {
                if (World.AllFlowers.ContainsKey(SaveChar.EntityID))
                {
                    Struct.Flowers F = World.AllFlowers[SaveChar.EntityID];
                    switch (Type)
                    {
                        #region Red Roses
                        case 0:
                            {
                                #region Item
                                string It = "751";
                                if (Flowers == 1)
                                    It += "001";
                                else if (Flowers == 3)
                                    It += "003";
                                else if (Flowers == 9)
                                    It += "009";
                                else if (Flowers == 99)
                                    It += "099";
                                else if (Flowers == 999)
                                    It += "999";
                                #endregion
                                //GC.LocalMessage(2005, "Item id : " + It);
                                GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
                                F.RedRoses += Flowers;
                                F.RedRoses2day += Flowers;
                                SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
                                SaveChar.FlowerName = "Red Roses";
                                break;
                            }
                        #endregion
                        #region Lilies
                        case 1:
                            {
                                #region Item
                                string It = "752";
                                if (Flowers == 1)
                                    It += "001";
                                else if (Flowers == 3)
                                    It += "003";
                                else if (Flowers == 9)
                                    It += "009";
                                else if (Flowers == 99)
                                    It += "099";
                                else if (Flowers == 999)
                                    It += "999";
                                #endregion
                                //GC.LocalMessage(2005, "Item id : " + It);
                                GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
                                F.Lilies += Flowers;
                                F.Lilies2day += Flowers;
                                SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
                                SaveChar.FlowerName = "Lilies";
                                break;
                            }
                        #endregion
                        #region Orchids
                        case 2:
                            {
                                #region Item
                                string It = "753";
                                if (Flowers == 1)
                                    It += "001";
                                else if (Flowers == 3)
                                    It += "003";
                                else if (Flowers == 9)
                                    It += "009";
                                else if (Flowers == 99)
                                    It += "099";
                                else if (Flowers == 999)
                                    It += "999";
                                #endregion
                                //GC.LocalMessage(2005, "Item id : " + It);
                                GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
                                F.Orchads += Flowers;
                                F.Orchads2day += Flowers;
                                SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
                                SaveChar.FlowerName = "Orchids";
                                break;
                            }
                        #endregion
                        #region Tulips
                        case 3:
                            {
                                #region Item
                                string It = "754";
                                if (Flowers == 1)
                                    It += "001";
                                else if (Flowers == 3)
                                    It += "003";
                                else if (Flowers == 9)
                                    It += "009";
                                else if (Flowers == 99)
                                    It += "099";
                                else if (Flowers == 999)
                                    It += "999";
                                #endregion
                                //GC.LocalMessage(2005, "Item id : " + It);
                                GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
                                F.Tulips += Flowers;
                                F.Tulips2day += Flowers;
                                SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
                                SaveChar.FlowerName = "Tulips";
                                break;
                            }
                        #endregion
                    }
                    GC.Message(2011, "What a love " + GC.MyChar.Name + " has sent " + Flowers.ToString() + " " + SaveChar.FlowerName + " To Precious " + SaveChar.Name + "");
                }
                else
                {
                    Struct.Flowers F = new Struct.Flowers();
                    switch (Type)
                    {
                        #region Red Roses
                        case 0:
                            {
                                #region Item
                                string It = "751";
                                if (Flowers == 1)
                                    It += "001";
                                else if (Flowers == 3)
                                    It += "003";
                                else if (Flowers == 9)
                                    It += "009";
                                else if (Flowers == 99)
                                    It += "099";
                                else if (Flowers == 999)
                                    It += "999";
                                #endregion
                                //GC.LocalMessage(2005, "Item id : " + It);
                                GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
                                F.RedRoses += Flowers;
                                F.RedRoses2day += Flowers;
                                SaveChar.FlowerName = "Red Roses";
                                break;
                            }
                        #endregion
                        #region Lilies
                        case 1:
                            {
                                #region Item
                                string It = "752";
                                if (Flowers == 1)
                                    It += "001";
                                else if (Flowers == 3)
                                    It += "003";
                                else if (Flowers == 9)
                                    It += "009";
                                else if (Flowers == 99)
                                    It += "099";
                                else if (Flowers == 999)
                                    It += "999";
                                #endregion
                                //GC.LocalMessage(2005, "Item id : " + It);
                                GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
                                F.Lilies += Flowers;
                                F.Lilies2day += Flowers;
                                SaveChar.FlowerName = "Lilies";
                                break;
                            }
                        #endregion
                        #region Orchids
                        case 2:
                            {
                                #region Item
                                string It = "753";
                                if (Flowers == 1)
                                    It += "001";
                                else if (Flowers == 3)
                                    It += "003";
                                else if (Flowers == 9)
                                    It += "009";
                                else if (Flowers == 99)
                                    It += "099";
                                else if (Flowers == 999)
                                    It += "999";
                                #endregion
                                //GC.LocalMessage(2005, "Item id : " + It);
                                GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
                                F.Orchads += Flowers;
                                F.Orchads2day += Flowers;
                                SaveChar.FlowerName = "Orchids";
                                break;
                            }
                        #endregion
                        #region Tulips
                        case 3:
                            {
                                #region Item
                                string It = "754";
                                if (Flowers == 1)
                                    It += "001";
                                else if (Flowers == 3)
                                    It += "003";
                                else if (Flowers == 9)
                                    It += "009";
                                else if (Flowers == 99)
                                    It += "099";
                                else if (Flowers == 999)
                                    It += "999";
                                #endregion
                                //GC.LocalMessage(2005, "Item id : " + It);
                                GC.MyChar.RemoveItem(GC.MyChar.NextItem(uint.Parse(It)));
                                F.Tulips += Flowers;
                                F.Tulips2day += Flowers;
                                SaveChar.FlowerName = "Tulips";
                                break;
                            }
                        #endregion
                        default:
                            Console.WriteLine("Unknown Flower type " + Type);
                            break;
                    }
                    World.AllFlowers.Add(SaveChar.EntityID, F);
                    SaveChar.Flowers = World.AllFlowers[SaveChar.EntityID];
                    GC.Message(2011, "What a love! " + GC.MyChar.Name + " has sent " + Flowers.ToString() + " " + SaveChar.FlowerName + " to your loved " + SaveChar.Name + "...");
                }
                // Database.SaveFlowerRank(SaveChar);
            }
            else
            {
                GC.LocalMessage(2005, "The target player isn't online right now.");
            }
        }
    }
    public partial class Struct
    {
        public class Flowers
        {
            public int RedRoses;
            public int RedRoses2day;
            public int Lilies;
            public int Lilies2day;
            public int Orchads;
            public int Orchads2day;
            public int Tulips;
            public int Tulips2day;
            public int Ammount;
        }
    }
}
In Packet Handler.cs Search for Case 1150 And Case 1151 then Add If You dont have those 1151 or 1150 Just add it in PacketHandler.cs

Code:
#region Flowers
                        case 1150:
                            {
                                Flowers.Handle(GC, Data);
                                break;
                            }
                        case 1151:
                            {
                                int sub = Data[4];
                                switch (sub)
                                {
                                    case 2://View
                                        {
                                            Struct.Flowers F = GC.MyChar.Flowers;
                                            string ToSend = " " + F.RedRoses.ToString() + " " + F.RedRoses2day.ToString() + " " + F.Lilies.ToString() + " " + F.Lilies2day.ToString() + " ";
                                            ToSend += F.Orchads.ToString() + " " + F.Orchads2day.ToString() + " " + F.Tulips.ToString() + " " + F.Tulips2day.ToString();
                                            GC.AddSend(Packets.FlowerPacket(ToSend));
                                            break;
                                        }
                                    default:
                                        {
                                            Console.WriteLine("Unknown 1151 Sub type : " + sub.ToString());
                                            break;
                                        }
                                }
                                break;
                            }
                        #endregion
Afcourse Credits also for 12Talys
-Shunsui- is offline  
Thanks
8 Users
Old 02/23/2010, 22:54   #7
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Quote:
Originally Posted by killersub View Post
awesome! this was/is really helpful for me! and for other people! +Kkkkkkk from me! and 1k cookies for u XD!

newbie question but I get 1 error...

"NewestCoServer.Character does not contain a definition for FlowerName"

What should I put it Character.cs XD?
public string FlowerName = "";
-Shunsui- is offline  
Old 02/23/2010, 22:56   #8
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 210
Quote:
Originally Posted by -Shunsui- View Post
public string FlowerName = "";
thanks! I got that since he updated it anyways thanks for helping
killersub is offline  
Old 02/23/2010, 22:58   #9
 
elite*gold: 0
Join Date: Aug 2008
Posts: 272
Received Thanks: 61
great job
ramix is offline  
Old 02/23/2010, 22:59   #10
 
elite*gold: 0
Join Date: Dec 2007
Posts: 378
Received Thanks: 163
@-Shunsui-

Thanks for that code, was wondering why the one I was using was f**ked. :P
walmartboi is offline  
Old 02/23/2010, 23:35   #11
 
elite*gold: 0
Join Date: Apr 2009
Posts: 772
Received Thanks: 441
lol... the code isn't fuc***... some people just doesn't know how to put :

Code:
 using NewestCOServer.Game;
at the very top of packethandling.cs.....
12tails is offline  
Old 02/23/2010, 23:51   #12
 
elite*gold: 0
Join Date: Dec 2007
Posts: 1,326
Received Thanks: 539
got some errors

[GM] is offline  
Old 02/24/2010, 00:04   #13
 
elite*gold: 0
Join Date: Apr 2009
Posts: 772
Received Thanks: 441
the right definitions are missing.....
12tails is offline  
Old 02/24/2010, 00:07   #14
 
elite*gold: 0
Join Date: Apr 2008
Posts: 275
Received Thanks: 43
Nice, but i still facing problems in 12tails release, still cant give a flowers in a girl. maybe i got mess up ill check mysource and thanks.
salem rey is offline  
Old 02/24/2010, 00:20   #15
 
elite*gold: 0
Join Date: Dec 2007
Posts: 1,326
Received Thanks: 539
Quote:
Originally Posted by 12tails View Post
the right definitions are missing.....
and what should i do to fix it?
[GM] is offline  
Reply


Similar Threads Similar Threads
Augu can post a Soucer 5165 With System Of Flowers and etc. ..
02/22/2010 - CO2 Private Server - 4 Replies
Augu can post a Soucer 5165 With System Of Flowers and etc. ..
[HELLP]any1 know how to add flowers in 5165Source!?Please Post Release Here!(or link)
01/20/2010 - CO2 Private Server - 17 Replies
please i like so much that flowers!!!
[RELEASE] COEMU 5095 SOURCE, WITH FLOWERS, NOBILITY, MANY MORE READ!
11/11/2009 - CO2 PServer Guides & Releases - 58 Replies
#closed.... -.-



All times are GMT +2. The time now is 20:01.


Powered by vBulletin®
Copyright ©2000 - 2021, 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 ©2021 elitepvpers All Rights Reserved.