Register for your free account! | Forgot your password?

You last visited: Today at 23:06

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

Advertisement



[Release] Flower System (5165)

Discussion on [Release] Flower System (5165) 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] Flower System (5165)

Heya!

Mostly complete... just figure a way to save it on your server....
ScreenShots:


So let's do it...

first go make a new structure for flowers and them use this:
them add this at character.cs more or less at line 1711:
and them add this packet to Packets.cs:
after it go to PacketHandler.cs and add this at main packet switch:
now them add this at World.cs at the public class World:

Code:
public static Dictionary<uint, Struct.Flowers> AllFlowers = new Dictionary<uint, Struct.Flowers>();
and now this is the load/save for MySql version.....

Code:
public static void SaveFlowerRank(Game.Character C)
        {
            MySqlConnection Conn = GetConnection();
            bool exist = false;
            string Name = C.Name;

            if (Name.Contains("[PM]"))
                Name.Replace("[PM]", "");

            try
            {
                lock (Conn)
                {
                    MySqlCommand Cmd = new MySqlCommand("SELECT * FROM `cq_flowers` WHERE `charuid2` = '" + C.Name + "'", Conn);
                    MySqlDataReader DR = Cmd.ExecuteReader();

                    while (DR.Read())
                    {
                        exist = true;
                    }
                    DR.Close();
                }
                lock (Conn)
                {
                    Struct.Flowers F = C.Flowers;
                    if (exist)
                    {
                        MySqlCommand Cmd = new MySqlCommand("UPDATE `cq_flowers` SET `redroses` = " + F.RedRoses + ", `redrosestoday` = " + F.RedRoses2day + ",`lilies` = " + F.Lilies + ",`liliestoday` = " + F.Lilies2day + ",`redrosestoday` = " + F.Tulips + ",`redrosestoday` = " + F.Tulips2day + ",`orchads` = " + F.Orchads + ",`orchadstoday` = " + F.Orchads2day + ", WHERE `charuid2` = \"" + Name + "\"", Conn);
                        Cmd.ExecuteNonQuery();
                    }
                    else
                    {
                        MySqlCommand Cmd = new MySqlCommand("INSERT INTO `cq_flowers` (redroses, redrosestoday, lilies, liliestoday, tulips, tulipstoday, orchads, orchadstoday, charuid, charuid2) VALUES (" + F.RedRoses + "," + F.RedRoses2day + "," + F.Lilies + "," + F.Lilies2day + "," + F.Tulips + "," + F.Tulips2day + "," + F.Orchads + "," + F.Orchads2day + "," + C.EntityID + ",'" + Name + "')", Conn);
                        Cmd.ExecuteNonQuery();
                    }
                }
                lock (Conn)
                {
                    string Save = DateTime.Now.Year + "-" + DateTime.Now.Month + "-" + DateTime.Now.Day;
                    MySqlCommand Cmd = new MySqlCommand("UPDATE `cq_saves` SET `save_flower` = " + Save + " WHERE `type` = 0", Conn);
                    Cmd.ExecuteNonQuery();
                }
                Conn.Close();
            }
            catch (Exception ex) { Console.WriteLine(ex.ToString()); Conn.Close(); return; }
        }
any problem post here : D

EDIT: Mostly Complete... thanks for waiting in advance....

for save go to this topic: CREDITS FOR saving flowers at flatfile source to : walmartboi

and For the ppl who think that has an error at the codes... just add this at the vcery top of PacketHandling.cs:

Code:
 using NewestCOServer.Game;
cya
12tails is offline  
Thanks
19 Users
Old 02/20/2010, 14:57   #2
 
elite*gold: 0
Join Date: Feb 2009
Posts: 262
Received Thanks: 161
Exemple FlowerSend

case 1150:
{
string ID = "";
for (byte x = 18; x < 25; x++)
{
ID += Convert.ToChar(Data[x]).ToString();
}
uint TargetID = uint.Parse(ID);
Character TC = (Character)Game.World.H_Chars[TargetID];
GC.LocalMessage(2005, "Sending flowers to " + TargetID.ToString() + ", wait for the answer.");
Game.Character Who = (Game.Character)World.H_Chars[TargetID];
// if (Game.World.H_Chars.Contains(TargetID))
{
string sendat = Who.Name;
GC.LocalMessage(2005, "Sending flower to " + sendat + ".");
Who.EntityID = TargetID;
//GC.AddSend(Packets.SendFlowerScreen(GC.MyChar.Enti tyID));
Who.MyClient.LocalMessage(2005, "You haven`t received any flowers today. Find someone to send you flowers!");
Who.MyClient.AddSend(Packets.GeneralData(GC.MyChar .EntityID, 0x4e0, 0, 0, 0x74));
// Who.MyClient.AddSend(Packets.ReceiveFlower(TC.Enti tyID, 0, 0, 0).Get);
}
for (byte i = 0; i < 12; i++)
Console.WriteLine(Data[i].ToString());
break;
}
teroareboss1 is offline  
Old 02/20/2010, 15:01   #3
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
Who.MyClient.AddSend(Packets.GeneralData(GC.MyChar .EntityID, 0x4e0, 0, 0, 0x74));

this make it send just sended 0 and a window.... i already tryied what did u post but doesn't seens to work.... : /
12tails is offline  
Old 02/20/2010, 15:54   #4
 
elite*gold: 0
Join Date: Feb 2009
Posts: 700
Received Thanks: 79
there we go again "its not complete" bro not to flame but at least finish it before releasing :P good job though. +k
copz1337 is offline  
Thanks
1 User
Old 02/20/2010, 15:55   #5
 
elite*gold: 0
Join Date: Feb 2010
Posts: 480
Received Thanks: 207
You shouldn't release something that is not complete!
Decker_ is offline  
Thanks
3 Users
Old 02/20/2010, 16:05   #6
 
salem rey's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 275
Received Thanks: 43
lol look what in the beggining of the thread, he needs help to finish this code.
salem rey is offline  
Old 02/20/2010, 16:32   #7
 
killersub's Avatar
 
elite*gold: 0
Join Date: May 2009
Posts: 884
Received Thanks: 211
maybe felipeboladao's code might work? not tested and not sure tho..

Code:
public static COPacket Flower2(uint Id, uint Type, uint Rank, uint RoseType)
{
string Flowers = Id.ToString();
byte[] Packet = new byte[1151 + 21 + Flowers.Length];
COPacket P = new COPacket(Packet);
P.WriteInt32(Type);
P.WriteInt32(Rank);
P.WriteInt32(RoseType);
P.WriteInt32(1);
P.WriteString(Flowers);
P.WriteInt64(0);

return P;
}
public static COPacket FlowerPacket(string Flowers, bool CreateInstance)
{
byte[] Packet = new byte[1150 + 21 + Flowers.Length];
COPacket P = new COPacket(Packet);
if (CreateInstance)
{
P.WriteInt16(1);
P.WriteInt16(0);
P.WriteInt16(0);
P.WriteInt32(1);
P.WriteString(Flowers);
P.WriteInt16(0);
}
return P;
}
public static COPacket SendFlowerScreen(uint Id)
{
byte[] Packet = new byte[0x3f2 + 28];
COPacket P = new COPacket(Packet);
P.WriteInt64(0);
P.WriteInt32(Id);
P.WriteInt16((ushort)0x4e0);
P.WriteInt16(0);
P.WriteInt16(0);
P.WriteInt16(0);
P.WriteInt16(0);
P.WriteInt16(0x74);
P.WriteInt64(0);

return P;
}

case 1150:
{
uint TargetID = BitConverter.ToUInt32(Data, 4);
GC.LocalMessage(2005, "Sending flower to target " + TargetID + ".");
if (Game.World.H_Chars.Contains(TargetID))
{
Game.World.H_Chars.Contains(TargetID);
GC.AddSend(Packets.SendFlowerScreen(GC.MyChar.Enti tyID));
}
break;
}
case 1151:
{
Features.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, true));
break;
}
credits go to felipeboladao as this is not my code...I wanted to see if this can help somehow lol...
killersub is offline  
Thanks
1 User
Old 02/20/2010, 16:53   #8
 
salem rey's Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 275
Received Thanks: 43
Thanks for this, its very usefull in my server
salem rey is offline  
Old 02/20/2010, 17:20   #9
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
this code doesn't work... some packets are wrong and one of them just close the client : /

anyway thanks... if someone can help... post please : D
12tails is offline  
Old 02/20/2010, 18:10   #10
 
-Shunsui-'s Avatar
 
elite*gold: 0
Join Date: Apr 2008
Posts: 1,152
Received Thanks: 321
Its A verry good start of, Good Job
-Shunsui- is offline  
Old 02/20/2010, 18:51   #11
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,785
Received Thanks: 5,304
Quote:
Originally Posted by Decker_ View Post
You shouldn't release something that is not complete!
Look at it this way, maybe he didn't complete it but he released the partial code and someone else might be able to complete it. So your little statement is wrong.
Arcо is offline  
Thanks
1 User
Old 02/20/2010, 19:49   #12
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
Arco... i'm working on it right now... but when i try to use the lilies , roses, orchilds or tulips.... it jump to the 1150 packet (like marry... it send a general packet... to get the item id or something like it...) i need only to get the item id at 1150 packet.. if i do.... the packet will be mostly complete.... can you help me?

cya!
12tails is offline  
Old 02/20/2010, 20:08   #13
 
Arcо's Avatar
 
elite*gold: 0
Join Date: Oct 2009
Posts: 8,785
Received Thanks: 5,304
Quote:
Originally Posted by 12tails View Post
Arco... i'm working on it right now... but when i try to use the lilies , roses, orchilds or tulips.... it jump to the 1150 packet (like marry... it send a general packet... to get the item id or something like it...) i need only to get the item id at 1150 packet.. if i do.... the packet will be mostly complete.... can you help me?

cya!
Add me on msn,
Arcо is offline  
Old 02/20/2010, 20:38   #14
 
elite*gold: 0
Join Date: Feb 2010
Posts: 480
Received Thanks: 207
Quote:
Originally Posted by .Arco View Post
Look at it this way, maybe he didn't complete it but he released the partial code and someone else might be able to complete it. So your little statement is wrong.
Not necessarily.
Everyone has there own opinions and my opinion is people shoudn't release stuff that is not completed.
I'm sure people would agree with me.

Off-topic:
Do you have a code that you can release that PM/GM's can drop things and people can see it?
Decker_ is offline  
Old 02/20/2010, 20:45   #15
 
12tails's Avatar
 
elite*gold: 0
Join Date: Apr 2009
Posts: 782
Received Thanks: 458
well... i released it and asked for help... also many ppl here relase never ending things -.-''

i just want help to over it.. then i'll release it full : X
12tails is offline  
Reply


Similar Threads Similar Threads
[Release] 5165 Warehouses Auth System
04/01/2011 - CO2 PServer Guides & Releases - 18 Replies
this is just a simple Auth system for warehouses. It will ask for password (set from WHGuardian) each time players will open their warehouse. Attempt limit is not included in this release... btw; with this release, warehouseGuardian will now save the password in Character file. here are the screenshots: http://img408.imageshack.us/img408/6986/98867182. jpg Click The Image to see more screen shots 1. Go to NPCDialog.cs and search for this code: public static void...
[RELEASE]Anti bot system 5165
06/15/2010 - CO2 PServer Guides & Releases - 15 Replies
Here is an simple anti bot system. Credits goes to Arco for the npc send thing :) First go to MyThreads.cs and find: interval = Interval; T = new Thread(new ThreadStart(Run)); T.Start();
[Release]NPC system 5165 simplified
05/10/2010 - CO2 PServer Guides & Releases - 14 Replies
//
some1 have 5165 source with flower system please post download link here
01/31/2010 - CO2 Private Server - 7 Replies
some1 have 5165 source with flower system please post download link here:(



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


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.