Send / TakeAway - Flower Icon

07/01/2011 09:45 zTek#1
So I am using this flower system edited by a couple people.
The thing is, I need help taking the icon away after it sends.
(If you do not know what I mean by Icon, look at [Only registered and activated users can see links. Click Here To Register...] picture.)

Alright, so far I know how to send the packet on log in, but that is about it.
Basically need help taking it away after I send a flower to a female player.
I should know how to make it appear again in a new day.

Thanks for reading, hopefully some of you can help.
Bye
07/01/2011 10:19 12tails#2
its a general data...
hmmm
something at 1000--1200
07/01/2011 10:33 Spirited#3
I would packet log if I were you.
Chris has an awesome guide that isn't hard to understand at all. It taught me everything I needed to know in 2 minutes. His proxy is hard to login with but it works. You should try it out.

PS: You might have to change case 1086 to 1060 in his proxy. (edit: 5165 uses 1086)
Here's a copy of what I packet logged just now for you:
Code:
Packet Nr 2025. Client -> Server, Length : 68, PacketType: 1150
3C 00 7E 04 00 00 00 00 42 37 1A 00 00 00 00 00      ;< ~    B7     
42 37 1A 00 01 00 00 00 00 00 00 00 00 00 00 00      ;B7            
00 00 00 00 00 00 00 00 00 00 00 00 00 00 00 00      ;                
00 00 00 00 00 00 00 00 00 00 00 00 54 51 43 6C      ;            TQCl
69 65 6E 74                                          ;ient


Packet Nr 2026. Server -> PACKET HANDLER, Length : 68, PacketType: 1150
3C 00 7E 04 00 00 00 00 00 00 00 00 00 00 00 00      ;< ~            
7E 53 70 69 72 69 74 65 64 7E 00 00 00 00 00 00      ;~Spirited~      
53 70 69 72 69 74 65 64 54 65 73 74 00 00 00 00      ;SpiritedTest    
0A 00 00 00 00 00 00 00 01 00 00 00 54 51 53 65      ;          TQSe
72 76 65 72                                          ;rver


Packet Nr 2027. Sending -> Client, Length : 68, PacketType: 1150
3C 00 7E 04 00 00 00 00 00 00 00 00 00 00 00 00      ;< ~            
7E 53 70 69 72 69 74 65 64 7E 00 00 00 00 00 00      ;~Spirited~      
53 70 69 72 69 74 65 64 54 65 73 74 00 00 00 00      ;SpiritedTest    
0A 00 00 00 00 00 00 00 01 00 00 00 54 51 53 65      ;          TQSe
72 76 65 72                                          ;rver


Packet Nr 2028. Server -> PACKET HANDLER, Length : 88, PacketType: 1151
50 00 7F 04 04 00 00 00 31 E2 CD 01 00 00 00 00      ;P    1โอ    
01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00      ;              
0A 00 00 00 00 00 00 00 42 37 1A 00 42 37 1A 00      ;       B7 B7 
53 70 69 72 69 74 65 64 54 65 73 74 00 00 00 00      ;SpiritedTest    
53 70 69 72 69 74 65 64 54 65 73 74 00 00 00 00      ;SpiritedTest    
54 51 53 65 72 76 65 72                              ;TQServer


Packet Nr 2029. Sending -> Client, Length : 88, PacketType: 1151
50 00 7F 04 04 00 00 00 31 E2 CD 01 00 00 00 00      ;P    1โอ    
01 00 00 00 00 00 00 00 01 00 00 00 00 00 00 00      ;              
0A 00 00 00 00 00 00 00 42 37 1A 00 42 37 1A 00      ;       B7 B7 
53 70 69 72 69 74 65 64 54 65 73 74 00 00 00 00      ;SpiritedTest    
53 70 69 72 69 74 65 64 54 65 73 74 00 00 00 00      ;SpiritedTest    
54 51 53 65 72 76 65 72                              ;TQServer
As I said, use Chris's guide on packet logging. It's easier than you think.
07/01/2011 13:20 { Angelius }#4
fang what you sniffed has nothing to do with removing the flower thing thats only the effect there is nothing to remove that icon , the only way to remove it is not to send it at all or when you give that flower away it disappears. and if you are not talking about taking the flower after its being sent than why are you sending it to the player any way ,

to have the flower a 1150 packet must be sent so if you are sending it to the players every time they login then it'll never go away . you have to have a check on weather they used the flower or not if not send the packet else keep going .

and that general data thing is never used once you send the flower anymore.

Edit:
(current patch i dont know about the lower patches and how its being done)
07/01/2011 13:49 Spirited#5
I packet sniffed it removing the flower. Are you sure that packet 1151 doesn't remove the flower? I've never coded flowers- but as I said, that's what I packet sniffed. Maybe the client automatically removes it (for all I know, like you said) and the server just keeps track of it. That does make sense...
07/02/2011 03:00 zTek#6
Thanks to Fang, I was able to remove the icon. However, I'm still trying to do this (You will know what I'm doing when you read it):

PHP Code:
if (!GC.DoneLoading)
                                            {
                                                if (
GC.MyChar.SendToday == 0)
                                                {
                                                    
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));
                                                    
GC.AddSend(Packets.GeneralData(GC.MyChar.EntityID124700116));
                                                    
GC.MyChar.SendToday 1;
                                                }
                                                else
                                                {
                                                    break;
                                                } 
PHP Code:
 public static void Handle()
        {
            if ((
DateTime.Now.Hour == 00) && (DateTime.Now.Minute == 1))
            {
                
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));
                
GC.MyChar.SendToday 1;
                
GC.AddSend(Packets.GeneralData(GC.MyChar.EntityID124700116));
            }
        } 
PHP Code:
 try
            {
                
FlowerSent.Handle();
            }
            catch { 
This i probably THE WORST way to do it no doubt, although I am trying my best.
If you read it, and understood what I'm trying to do, can you help me to see if I'm doing it right, or maybe lead me to it.

Thanks
07/02/2011 03:43 { Angelius }#7
Quote:
Originally Posted by Fаng View Post
I packet sniffed it removing the flower. Are you sure that packet 1151 doesn't remove the flower? I've never coded flowers- but as I said, that's what I packet sniffed. Maybe the client automatically removes it (for all I know, like you said) and the server just keeps track of it. That does make sense...
no one gets a flower until the packet has been sent and when the player uses the flower the client removes it the only thing left is to make sure that the packet want be sent until the next day after the flower is been used .

i was bored that i coded the whole thin lol
07/02/2011 06:02 Spirited#8
Quote:
Originally Posted by { Angelius } View Post
no one gets a flower until the packet has been sent and when the player uses the flower the client removes it the only thing left is to make sure that the packet want be sent until the next day after the flower is been used .

i was bored that i coded the whole thin lol
Idk why you're bragging to me about it. I haven't started flowers yet- I still have a lot to do before then. If you finished it then help the OP... I don't know much about flowers yet, and considering you finished it- you should be able to help him more than I can.
07/02/2011 09:08 zTek#9
I successfully made it so that it appears on logi n (If you haven't sent it yet), and takes it away when it sends. Now I need to make it so that it will start all over at 00:01. Thanks for all the help everyone.

If anyone wants the codes here they are:
Code:
}
                                        World.AllFlowers.Add(SaveChar.EntityID, F);
                                        [COLOR="Red"]GC.MyChar.SendToday = 1;[/COLOR]
                                        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 + "...");
                                    }
Code:
public byte SendToday = 0;
Code:
public static void Handle()
        {
            foreach (Character C in Game.World.H_Chars.Values)
            {
                if (C.MyClient.MyChar.SendToday == 1)
                {
                    C.MyClient.AddSend(Packets.GeneralData(C.MyClient.MyChar.EntityID, 1247, 0, 0, 116));
                }
            }
        }
Code:
 try
            {
                FlowerSent.Handle();
            }
            catch { }
07/02/2011 09:32 { Angelius }#10
Quote:
Originally Posted by Fаng View Post
Idk why you're bragging to me about it.
....

Edit : now i know i should never respond to any thread that contains your name >:P
07/02/2011 10:22 teroareboss1#11
Here all:

Code:
#region Flower
     
        public static void AddFlowers(Client.GameState client, byte[]  packet )
        {
            if (packet[4] == 2)
            {
                if (client.Entity.MyFlowers != null)
                {
                    Game.Struct.Flowers F = client.Entity.MyFlowers;
                  //  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();
                    Network.GamePackets.FlowerPacket flow = new FlowerPacket(F);
                    client.Send(flow.ToArray());

                 
                    int mybestcount = 0;
                    if (F.Lilies > mybestcount)
                        mybestcount = F.Lilies;
                    if (F.Orchads > mybestcount)
                        mybestcount = F.Orchads;
                    if (F.RedRoses > mybestcount)
                        mybestcount = F.RedRoses;
                    if (F.Tulips > mybestcount)
                        mybestcount = F.Tulips;



                    if (F.Lilies == mybestcount)
                    {
                        if(mybestcount >= ServerBase.Kernel.MaxLilies)
                            {
                        client.Entity.ActualMyTypeFlower = 30010102;
                        FlowerSpawn fl = new FlowerSpawn("1", client.Entity.Name, F.Lilies.ToString(), client.Entity.UID.ToString(), 30000102);
                        client.Send(fl.ThePacket());
                        ServerBase.Kernel.MaxLilies = (uint)mybestcount;
                    }
                    }
                    if (F.Orchads == mybestcount)
                    {if(mybestcount >= ServerBase.Kernel.MaxOrchads)
                            {
                        client.Entity.ActualMyTypeFlower = 30010202;
                        FlowerSpawn fl = new FlowerSpawn("1", client.Entity.Name, F.Orchads.ToString(), client.Entity.UID.ToString(), 30000202);
                        client.Send(fl.ThePacket());
                        ServerBase.Kernel.MaxOrchads = (uint)mybestcount;
                            }
                    }
                    if (F.RedRoses == mybestcount)
                    {
                        if (mybestcount >= ServerBase.Kernel.MaxRoses)
                        {
                        client.Entity.ActualMyTypeFlower = 30010002;
                        FlowerSpawn fl = new FlowerSpawn("1", client.Entity.Name, F.RedRoses.ToString(), client.Entity.UID.ToString(), 30000002);
                        client.Send(fl.ThePacket());
                        ServerBase.Kernel.MaxRoses = (uint)mybestcount;
                            }
                    }
                    if (F.Tulips == mybestcount)
                    {
                        if (mybestcount >= ServerBase.Kernel.MaxTulips)
                        {
                        client.Entity.ActualMyTypeFlower = 30010302;
                        FlowerSpawn fl = new FlowerSpawn("1", client.Entity.Name, F.Tulips.ToString(), client.Entity.UID.ToString(), 30000302);
                        client.Send(fl.ThePacket());
                        } ServerBase.Kernel.MaxTulips = (uint)mybestcount;
                    }
                }
                else
                {
                    client.Entity.MyFlowers = new Conquer_Online_Server.Game.Struct.Flowers();
                    Game.Struct.Flowers F = client.Entity.MyFlowers;
                    Network.GamePackets.FlowerPacket flow = new FlowerPacket(F);
                    client.Send(flow.ToArray());
                    Database.Flowers.SaveFlowerRank(client); 
                }
                byte[] packe2nd = new byte[24]
                                {
                                    0x10, 0x00 , 0x7F , 0x04 , 0x05 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00   
                                   , 0x54 , 0x51 , 0x53 , 0x65 , 0x72 , 0x76 , 0x65 , 0x72                  
                                };
                client.Send(packe2nd);
            }
        }
        public static void SendFlowers(Client.GameState client, byte[] packet)
        {
            uint TargetID = BitConverter.ToUInt32(packet, 8);
            int Flowers = BitConverter.ToUInt16(packet, 20);
            int Type = packet[24];
            if (Flowers == 1)
            {
                if (client.Entity.AddFlower == 0)
                {
                    client.Send(new Network.GamePackets.Message("Sorry, but you send the flower today! ", System.Drawing.Color.White, Message.Center));
                    return;
                }
            }

            bool change = false;
            if (ServerBase.Kernel.GamePool.ContainsKey(TargetID))
            {
                Client.GameState Cclient = ServerBase.Kernel.GamePool[TargetID];
                if (Conquer_Online_Server.ServerBase.Kernel.AllFlower.ContainsKey(Cclient.Entity.UID))
                {
                    if (Cclient.Entity.Body.ToString().EndsWith("3") || Cclient.Entity.Body.ToString().EndsWith("4"))
                        return;
                    byte[] packe2nd2 = new byte[24]
                                {
                                    0x10, 0x00 , 0x7F , 0x04 , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00   
                                   , 0x54 , 0x51 , 0x53 , 0x65 , 0x72 , 0x76 , 0x65 , 0x72                  
                                };
                    Cclient.Send(packe2nd2);
                    Game.Struct.Flowers F = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                    switch (Type)
                    {
            
                        case 0:
                            {
                                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";
                                if (client.Inventory.Contains(uint.Parse(It), 1))
                                    client.Inventory.Remove(uint.Parse(It), 1);
                                client.Send(packet);
                                F.RedRoses += Flowers;
                                F.RedRoses2day += Flowers;
                                //if (F.RedRoses > 100000)
                                //   Cclient.Entity.FlowerSend = "TakeOnRoseSuit";
                                Cclient.Entity.MyFlowers = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                                Cclient.Send(packet);

                                int mybestcount = 0;
                                if (F.Lilies > mybestcount)
                                    mybestcount = F.Lilies;
                                if (F.Orchads > mybestcount)
                                    mybestcount = F.Orchads;
                                if (F.RedRoses > mybestcount)
                                    mybestcount = F.RedRoses;
                                if (F.Tulips > mybestcount)
                                    mybestcount = F.Tulips;
                                if (F.RedRoses == mybestcount)
                                {
                                    if(F.RedRoses >= ServerBase.Kernel.MaxRoses)
                                    {
                                    Cclient.Entity.ActualMyTypeFlower = 30010002;
                                    Cclient.Send(new FlowerSpawn("1", Cclient.Entity.Name, F.RedRoses.ToString(), Cclient.Entity.UID.ToString(), 30000002).ThePacket());
                                    ServerBase.Kernel.MaxRoses = (uint)F.RedRoses;
                                    change = true;
                                    }
                                }

                                break;
                            }
                        case 1:
                            {
                                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";
                                if (client.Inventory.Contains(uint.Parse(It), 1))
                                    client.Inventory.Remove(uint.Parse(It), 1);
                                client.Send(packet);
                                F.Lilies += Flowers;
                                F.Lilies2day += Flowers;
                                //if (F.Lilies > 100000)
                                //    Cclient.Entity.FlowerSend = "TakeOnLilySuit";
                                
                                Cclient.Entity.MyFlowers = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                                Cclient.Send(packet);
                                int mybestcount = 0;
                                if (F.Lilies > mybestcount)
                                    mybestcount = F.Lilies;
                                if (F.Orchads > mybestcount)
                                    mybestcount = F.Orchads;
                                if (F.RedRoses > mybestcount)
                                    mybestcount = F.RedRoses;
                                if (F.Tulips > mybestcount)
                                    mybestcount = F.Tulips;
                                if (F.Lilies == mybestcount)
                                {
                                     if(F.RedRoses >= ServerBase.Kernel.MaxLilies)
                                    {
                                    Cclient.Entity.ActualMyTypeFlower = 30010102;
                                    FlowerSpawn fl = new FlowerSpawn("1", Cclient.Entity.Name, F.Lilies.ToString(), Cclient.Entity.UID.ToString(), 30000102);
                                    Cclient.Send(fl.ThePacket());
                                    ServerBase.Kernel.MaxLilies = (uint)F.RedRoses;
                                         change = true;
                                }
                                     }
                                break;
                            }
                        case 2:
                            {
                                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";
                                if (client.Inventory.Contains(uint.Parse(It), 1))
                                    client.Inventory.Remove(uint.Parse(It), 1);
                                client.Send(packet);
                                F.Orchads += Flowers;
                                F.Orchads2day += Flowers;
                                //if (F.Orchads> 100000)
                                //    Cclient.Entity.FlowerSend = "TakeOnOrchisSuit";
                              
                                Cclient.Entity.MyFlowers = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                                Cclient.Send(packet);
                                int mybestcount = 0;
                                if (F.Lilies > mybestcount)
                                    mybestcount = F.Lilies;
                                if (F.Orchads > mybestcount)
                                    mybestcount = F.Orchads;
                                if (F.RedRoses > mybestcount)
                                    mybestcount = F.RedRoses;
                                if (F.Tulips > mybestcount)
                                    mybestcount = F.Tulips;
                                if (F.Orchads == mybestcount)
                                {
                                    if(F.Orchads >= ServerBase.Kernel.MaxOrchads)
                                        {
                                    Cclient.Entity.ActualMyTypeFlower = 30010202;
                                    FlowerSpawn fl = new FlowerSpawn("1", Cclient.Entity.Name, F.Orchads.ToString(), Cclient.Entity.UID.ToString(), 30000202);
                                    Cclient.Send(fl.ThePacket());
                                    ServerBase.Kernel.MaxOrchads = (uint)F.Orchads;
                                        change = true;
                                }
                                }

                                break;

                            }
                        case 3:
                            {
                                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";

                                if (client.Inventory.Contains(uint.Parse(It), 1))
                                    client.Inventory.Remove(uint.Parse(It), 1);
                                client.Send(packet);
                                F.Tulips += Flowers;
                                F.Tulips2day += Flowers;
                                //if (F.Tulips > 100000)
                                //    Cclient.Entity.FlowerSend = "TakeOnTulipSuit";
                               
                                Cclient.Entity.MyFlowers = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                                Cclient.Send(packet);
                                int mybestcount = 0;
                                if (F.Lilies > mybestcount)
                                    mybestcount = F.Lilies;
                                if (F.Orchads > mybestcount)
                                    mybestcount = F.Orchads;
                                if (F.RedRoses > mybestcount)
                                    mybestcount = F.RedRoses;
                                if (F.Tulips > mybestcount)
                                    mybestcount = F.Tulips;
                                if (F.Tulips == mybestcount)
                                {
                         if(F.Tulips >= ServerBase.Kernel.MaxTulips)
                         {
                                    Cclient.Entity.ActualMyTypeFlower = 30010302;
                                    FlowerSpawn fl = new FlowerSpawn("1", Cclient.Entity.Name, F.Tulips.ToString(), Cclient.Entity.UID.ToString(), 30000302);
                       
                                    Cclient.Send(fl.ThePacket());
                                    ServerBase.Kernel.MaxTulips = (uint)F.Tulips;
                        change = true;
                                }
                                }

                                break;
                            }
                    }

                    if (Flowers == 1)
                        client.Entity.AddFlower = 0;

                   
                    //client.Send(new FlowerSpawn2(Cclient.Entity.UID.ToString()).ThePacket());
                    string name = client.Entity.Name + " " + Cclient.Entity.Name + " " + Flowers + " " + Type + "";
                    byte[] Buffer = new byte[68];
                    Network.Writer.WriteUInt16((ushort)(60), 0, Buffer);
                    Network.Writer.WriteUInt16(1150, 2, Buffer);

                    Network.Writer.WriteUInt32((uint)Flowers, 48, Buffer);

                    Network.Writer.WriteUInt32((uint)Type, 56, Buffer);//52

                    for (int i = 0; i < client.Entity.Name.Length; i++)
                    {
                        try
                        {
                            Buffer[16 + i] = Convert.ToByte(client.Entity.Name[i]);
                        }
                        catch { }
                    }

                    for (int i = 0; i < Cclient.Entity.Name.Length; i++)
                    {
                        try
                        {
                            Buffer[32 + i] = Convert.ToByte(Cclient.Entity.Name[i]);
                        }
                        catch { }
                    }

                    Cclient.Send(Buffer);
                    if (Flowers == 1)
                        client.Send(Buffer);
                    //clienSend(new FlowerSpawn2(Cclient.Entity.UID.ToString()).ThePacket());
                    Network.GamePackets._String  strgp = new Network.GamePackets._String(true);
                    strgp.Texts.Add("NEW-flower-r-1");
                    strgp.TextsCount = 1;
                    strgp.Type = 10;
                    strgp.UID = client.Entity.UID;
                    client.Screen.Reload(strgp);
                 
                    strgp.UID = Cclient.Entity.UID;
               
                    Cclient.Screen.Reload(strgp);

     
                    Network.GamePackets.FlowerPacket flow = new FlowerPacket(F);
                    Cclient.Send(flow.ToArray());
                  
                    Database.Flowers.SaveFlowerRank(Cclient);

                    if(change)
                    {
                    byte[] packe2nd = new byte[24]
                                {
                                    0x10, 0x00 , 0x7F , 0x04 , 0x05 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00   
                                   , 0x54 , 0x51 , 0x53 , 0x65 , 0x72 , 0x76 , 0x65 , 0x72                  
                                };
                    Cclient.Send(packe2nd);
                }
                }
            }
        }
        #endregion
SpawnCharacter
Code:
    public uint ActualMyTypeFlower
        {
            get { return f_flower; }
            set
            {
                //30010202 orchids
                //30010002 rouse
                //30010102 lilyes
                //30010302 orchids

                f_flower = value;
                WriteUInt32(value, 113, SpawnPacket);//91
            }
        }
FlowerPacket
Code:
 public class FlowerPacket : Writer
    {
        private byte[] Buffer;
        public FlowerPacket(Game.Struct.Flowers Flower)
        {
            Buffer = new byte[8 + 56];
            WriteUInt16((ushort)(Buffer.Length - 8), 0, Buffer);
            WriteUInt16(1150, 2, Buffer);
            Buffer[4] = 1;

            WriteUInt32((uint)Flower.RedRoses, 16, Buffer);
            WriteUInt32((uint)Flower.RedRoses2day, 20, Buffer);

            WriteUInt32((uint)Flower.Lilies, 24, Buffer);
            WriteUInt32((uint)Flower.Lilies2day, 28, Buffer);

            WriteUInt32((uint)Flower.Orchads, 32, Buffer);
            WriteUInt32((uint)Flower.Orchads2day, 36, Buffer);

            WriteUInt32((uint)Flower.Tulips, 40, Buffer);
            WriteUInt32((uint)Flower.Tulips2day, 44, Buffer);

        }
        public void Deserialize(byte[] buffer)
        {
            Buffer = buffer;
        }
        public byte[] ToArray()
        {
            return Buffer;
        }
    }
FlowerSpawn//just you icon
Code:
public class FlowerSpawn : Writer
    {
        byte[] Buffer;
        public FlowerSpawn(string Type, string name, string Flowers, string UID, uint FlowerID)
        {
            string send = Type + " " + Flowers + " " + UID + " " + UID + " " + name + " " + name + "";
            Buffer
                = new byte[88];//18
            WriteUInt16((byte)(80), 0, Buffer);
            WriteUInt16(1151, 2, Buffer);

            Buffer[4] = 2;
            WriteUInt32(FlowerID, 8, Buffer);
            Buffer[16] = 1;
            Buffer[24] = 1;
            Buffer[32] = 1;

            WriteUInt32(uint.Parse(UID), 40, Buffer);
            WriteUInt32(uint.Parse(UID), 44, Buffer);
            //Buffer[17] = 1;//13
            // Buffer[18] = (byte)(send.Length & 255);
            for (int i = 0; i < send.Length; i++)
            {
                try
                {
                    Buffer[48 + i] = Convert.ToByte(send[i]);
                    Buffer[48 + i + 16] = Convert.ToByte(send[i]);

                }
                catch { }
            }
        }
        public byte[] ThePacket()
        {
            return Buffer;
        }
    }
08/10/2011 18:18 shadowman123#12
tell us Where we should use these codes
08/18/2011 16:05 alaa410#13
Quote:
Originally Posted by teroareboss1 View Post
Here all:

Code:
#region Flower
     
        public static void AddFlowers(Client.GameState client, byte[]  packet )
        {
            if (packet[4] == 2)
            {
                if (client.Entity.MyFlowers != null)
                {
                    Game.Struct.Flowers F = client.Entity.MyFlowers;
                  //  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();
                    Network.GamePackets.FlowerPacket flow = new FlowerPacket(F);
                    client.Send(flow.ToArray());

                 
                    int mybestcount = 0;
                    if (F.Lilies > mybestcount)
                        mybestcount = F.Lilies;
                    if (F.Orchads > mybestcount)
                        mybestcount = F.Orchads;
                    if (F.RedRoses > mybestcount)
                        mybestcount = F.RedRoses;
                    if (F.Tulips > mybestcount)
                        mybestcount = F.Tulips;



                    if (F.Lilies == mybestcount)
                    {
                        if(mybestcount >= ServerBase.Kernel.MaxLilies)
                            {
                        client.Entity.ActualMyTypeFlower = 30010102;
                        FlowerSpawn fl = new FlowerSpawn("1", client.Entity.Name, F.Lilies.ToString(), client.Entity.UID.ToString(), 30000102);
                        client.Send(fl.ThePacket());
                        ServerBase.Kernel.MaxLilies = (uint)mybestcount;
                    }
                    }
                    if (F.Orchads == mybestcount)
                    {if(mybestcount >= ServerBase.Kernel.MaxOrchads)
                            {
                        client.Entity.ActualMyTypeFlower = 30010202;
                        FlowerSpawn fl = new FlowerSpawn("1", client.Entity.Name, F.Orchads.ToString(), client.Entity.UID.ToString(), 30000202);
                        client.Send(fl.ThePacket());
                        ServerBase.Kernel.MaxOrchads = (uint)mybestcount;
                            }
                    }
                    if (F.RedRoses == mybestcount)
                    {
                        if (mybestcount >= ServerBase.Kernel.MaxRoses)
                        {
                        client.Entity.ActualMyTypeFlower = 30010002;
                        FlowerSpawn fl = new FlowerSpawn("1", client.Entity.Name, F.RedRoses.ToString(), client.Entity.UID.ToString(), 30000002);
                        client.Send(fl.ThePacket());
                        ServerBase.Kernel.MaxRoses = (uint)mybestcount;
                            }
                    }
                    if (F.Tulips == mybestcount)
                    {
                        if (mybestcount >= ServerBase.Kernel.MaxTulips)
                        {
                        client.Entity.ActualMyTypeFlower = 30010302;
                        FlowerSpawn fl = new FlowerSpawn("1", client.Entity.Name, F.Tulips.ToString(), client.Entity.UID.ToString(), 30000302);
                        client.Send(fl.ThePacket());
                        } ServerBase.Kernel.MaxTulips = (uint)mybestcount;
                    }
                }
                else
                {
                    client.Entity.MyFlowers = new Conquer_Online_Server.Game.Struct.Flowers();
                    Game.Struct.Flowers F = client.Entity.MyFlowers;
                    Network.GamePackets.FlowerPacket flow = new FlowerPacket(F);
                    client.Send(flow.ToArray());
                    Database.Flowers.SaveFlowerRank(client); 
                }
                byte[] packe2nd = new byte[24]
                                {
                                    0x10, 0x00 , 0x7F , 0x04 , 0x05 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00   
                                   , 0x54 , 0x51 , 0x53 , 0x65 , 0x72 , 0x76 , 0x65 , 0x72                  
                                };
                client.Send(packe2nd);
            }
        }
        public static void SendFlowers(Client.GameState client, byte[] packet)
        {
            uint TargetID = BitConverter.ToUInt32(packet, 8);
            int Flowers = BitConverter.ToUInt16(packet, 20);
            int Type = packet[24];
            if (Flowers == 1)
            {
                if (client.Entity.AddFlower == 0)
                {
                    client.Send(new Network.GamePackets.Message("Sorry, but you send the flower today! ", System.Drawing.Color.White, Message.Center));
                    return;
                }
            }

            bool change = false;
            if (ServerBase.Kernel.GamePool.ContainsKey(TargetID))
            {
                Client.GameState Cclient = ServerBase.Kernel.GamePool[TargetID];
                if (Conquer_Online_Server.ServerBase.Kernel.AllFlower.ContainsKey(Cclient.Entity.UID))
                {
                    if (Cclient.Entity.Body.ToString().EndsWith("3") || Cclient.Entity.Body.ToString().EndsWith("4"))
                        return;
                    byte[] packe2nd2 = new byte[24]
                                {
                                    0x10, 0x00 , 0x7F , 0x04 , 0x02 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00   
                                   , 0x54 , 0x51 , 0x53 , 0x65 , 0x72 , 0x76 , 0x65 , 0x72                  
                                };
                    Cclient.Send(packe2nd2);
                    Game.Struct.Flowers F = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                    switch (Type)
                    {
            
                        case 0:
                            {
                                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";
                                if (client.Inventory.Contains(uint.Parse(It), 1))
                                    client.Inventory.Remove(uint.Parse(It), 1);
                                client.Send(packet);
                                F.RedRoses += Flowers;
                                F.RedRoses2day += Flowers;
                                //if (F.RedRoses > 100000)
                                //   Cclient.Entity.FlowerSend = "TakeOnRoseSuit";
                                Cclient.Entity.MyFlowers = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                                Cclient.Send(packet);

                                int mybestcount = 0;
                                if (F.Lilies > mybestcount)
                                    mybestcount = F.Lilies;
                                if (F.Orchads > mybestcount)
                                    mybestcount = F.Orchads;
                                if (F.RedRoses > mybestcount)
                                    mybestcount = F.RedRoses;
                                if (F.Tulips > mybestcount)
                                    mybestcount = F.Tulips;
                                if (F.RedRoses == mybestcount)
                                {
                                    if(F.RedRoses >= ServerBase.Kernel.MaxRoses)
                                    {
                                    Cclient.Entity.ActualMyTypeFlower = 30010002;
                                    Cclient.Send(new FlowerSpawn("1", Cclient.Entity.Name, F.RedRoses.ToString(), Cclient.Entity.UID.ToString(), 30000002).ThePacket());
                                    ServerBase.Kernel.MaxRoses = (uint)F.RedRoses;
                                    change = true;
                                    }
                                }

                                break;
                            }
                        case 1:
                            {
                                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";
                                if (client.Inventory.Contains(uint.Parse(It), 1))
                                    client.Inventory.Remove(uint.Parse(It), 1);
                                client.Send(packet);
                                F.Lilies += Flowers;
                                F.Lilies2day += Flowers;
                                //if (F.Lilies > 100000)
                                //    Cclient.Entity.FlowerSend = "TakeOnLilySuit";
                                
                                Cclient.Entity.MyFlowers = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                                Cclient.Send(packet);
                                int mybestcount = 0;
                                if (F.Lilies > mybestcount)
                                    mybestcount = F.Lilies;
                                if (F.Orchads > mybestcount)
                                    mybestcount = F.Orchads;
                                if (F.RedRoses > mybestcount)
                                    mybestcount = F.RedRoses;
                                if (F.Tulips > mybestcount)
                                    mybestcount = F.Tulips;
                                if (F.Lilies == mybestcount)
                                {
                                     if(F.RedRoses >= ServerBase.Kernel.MaxLilies)
                                    {
                                    Cclient.Entity.ActualMyTypeFlower = 30010102;
                                    FlowerSpawn fl = new FlowerSpawn("1", Cclient.Entity.Name, F.Lilies.ToString(), Cclient.Entity.UID.ToString(), 30000102);
                                    Cclient.Send(fl.ThePacket());
                                    ServerBase.Kernel.MaxLilies = (uint)F.RedRoses;
                                         change = true;
                                }
                                     }
                                break;
                            }
                        case 2:
                            {
                                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";
                                if (client.Inventory.Contains(uint.Parse(It), 1))
                                    client.Inventory.Remove(uint.Parse(It), 1);
                                client.Send(packet);
                                F.Orchads += Flowers;
                                F.Orchads2day += Flowers;
                                //if (F.Orchads> 100000)
                                //    Cclient.Entity.FlowerSend = "TakeOnOrchisSuit";
                              
                                Cclient.Entity.MyFlowers = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                                Cclient.Send(packet);
                                int mybestcount = 0;
                                if (F.Lilies > mybestcount)
                                    mybestcount = F.Lilies;
                                if (F.Orchads > mybestcount)
                                    mybestcount = F.Orchads;
                                if (F.RedRoses > mybestcount)
                                    mybestcount = F.RedRoses;
                                if (F.Tulips > mybestcount)
                                    mybestcount = F.Tulips;
                                if (F.Orchads == mybestcount)
                                {
                                    if(F.Orchads >= ServerBase.Kernel.MaxOrchads)
                                        {
                                    Cclient.Entity.ActualMyTypeFlower = 30010202;
                                    FlowerSpawn fl = new FlowerSpawn("1", Cclient.Entity.Name, F.Orchads.ToString(), Cclient.Entity.UID.ToString(), 30000202);
                                    Cclient.Send(fl.ThePacket());
                                    ServerBase.Kernel.MaxOrchads = (uint)F.Orchads;
                                        change = true;
                                }
                                }

                                break;

                            }
                        case 3:
                            {
                                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";

                                if (client.Inventory.Contains(uint.Parse(It), 1))
                                    client.Inventory.Remove(uint.Parse(It), 1);
                                client.Send(packet);
                                F.Tulips += Flowers;
                                F.Tulips2day += Flowers;
                                //if (F.Tulips > 100000)
                                //    Cclient.Entity.FlowerSend = "TakeOnTulipSuit";
                               
                                Cclient.Entity.MyFlowers = Conquer_Online_Server.ServerBase.Kernel.AllFlower[Cclient.Entity.UID];
                                Cclient.Send(packet);
                                int mybestcount = 0;
                                if (F.Lilies > mybestcount)
                                    mybestcount = F.Lilies;
                                if (F.Orchads > mybestcount)
                                    mybestcount = F.Orchads;
                                if (F.RedRoses > mybestcount)
                                    mybestcount = F.RedRoses;
                                if (F.Tulips > mybestcount)
                                    mybestcount = F.Tulips;
                                if (F.Tulips == mybestcount)
                                {
                         if(F.Tulips >= ServerBase.Kernel.MaxTulips)
                         {
                                    Cclient.Entity.ActualMyTypeFlower = 30010302;
                                    FlowerSpawn fl = new FlowerSpawn("1", Cclient.Entity.Name, F.Tulips.ToString(), Cclient.Entity.UID.ToString(), 30000302);
                       
                                    Cclient.Send(fl.ThePacket());
                                    ServerBase.Kernel.MaxTulips = (uint)F.Tulips;
                        change = true;
                                }
                                }

                                break;
                            }
                    }

                    if (Flowers == 1)
                        client.Entity.AddFlower = 0;

                   
                    //client.Send(new FlowerSpawn2(Cclient.Entity.UID.ToString()).ThePacket());
                    string name = client.Entity.Name + " " + Cclient.Entity.Name + " " + Flowers + " " + Type + "";
                    byte[] Buffer = new byte[68];
                    Network.Writer.WriteUInt16((ushort)(60), 0, Buffer);
                    Network.Writer.WriteUInt16(1150, 2, Buffer);

                    Network.Writer.WriteUInt32((uint)Flowers, 48, Buffer);

                    Network.Writer.WriteUInt32((uint)Type, 56, Buffer);//52

                    for (int i = 0; i < client.Entity.Name.Length; i++)
                    {
                        try
                        {
                            Buffer[16 + i] = Convert.ToByte(client.Entity.Name[i]);
                        }
                        catch { }
                    }

                    for (int i = 0; i < Cclient.Entity.Name.Length; i++)
                    {
                        try
                        {
                            Buffer[32 + i] = Convert.ToByte(Cclient.Entity.Name[i]);
                        }
                        catch { }
                    }

                    Cclient.Send(Buffer);
                    if (Flowers == 1)
                        client.Send(Buffer);
                    //clienSend(new FlowerSpawn2(Cclient.Entity.UID.ToString()).ThePacket());
                    Network.GamePackets._String  strgp = new Network.GamePackets._String(true);
                    strgp.Texts.Add("NEW-flower-r-1");
                    strgp.TextsCount = 1;
                    strgp.Type = 10;
                    strgp.UID = client.Entity.UID;
                    client.Screen.Reload(strgp);
                 
                    strgp.UID = Cclient.Entity.UID;
               
                    Cclient.Screen.Reload(strgp);

     
                    Network.GamePackets.FlowerPacket flow = new FlowerPacket(F);
                    Cclient.Send(flow.ToArray());
                  
                    Database.Flowers.SaveFlowerRank(Cclient);

                    if(change)
                    {
                    byte[] packe2nd = new byte[24]
                                {
                                    0x10, 0x00 , 0x7F , 0x04 , 0x05 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00 , 0x00   
                                   , 0x54 , 0x51 , 0x53 , 0x65 , 0x72 , 0x76 , 0x65 , 0x72                  
                                };
                    Cclient.Send(packe2nd);
                }
                }
            }
        }
        #endregion
SpawnCharacter
Code:
    public uint ActualMyTypeFlower
        {
            get { return f_flower; }
            set
            {
                //30010202 orchids
                //30010002 rouse
                //30010102 lilyes
                //30010302 orchids

                f_flower = value;
                WriteUInt32(value, 113, SpawnPacket);//91
            }
        }
FlowerPacket
Code:
 public class FlowerPacket : Writer
    {
        private byte[] Buffer;
        public FlowerPacket(Game.Struct.Flowers Flower)
        {
            Buffer = new byte[8 + 56];
            WriteUInt16((ushort)(Buffer.Length - 8), 0, Buffer);
            WriteUInt16(1150, 2, Buffer);
            Buffer[4] = 1;

            WriteUInt32((uint)Flower.RedRoses, 16, Buffer);
            WriteUInt32((uint)Flower.RedRoses2day, 20, Buffer);

            WriteUInt32((uint)Flower.Lilies, 24, Buffer);
            WriteUInt32((uint)Flower.Lilies2day, 28, Buffer);

            WriteUInt32((uint)Flower.Orchads, 32, Buffer);
            WriteUInt32((uint)Flower.Orchads2day, 36, Buffer);

            WriteUInt32((uint)Flower.Tulips, 40, Buffer);
            WriteUInt32((uint)Flower.Tulips2day, 44, Buffer);

        }
        public void Deserialize(byte[] buffer)
        {
            Buffer = buffer;
        }
        public byte[] ToArray()
        {
            return Buffer;
        }
    }
FlowerSpawn//just you icon
Code:
public class FlowerSpawn : Writer
    {
        byte[] Buffer;
        public FlowerSpawn(string Type, string name, string Flowers, string UID, uint FlowerID)
        {
            string send = Type + " " + Flowers + " " + UID + " " + UID + " " + name + " " + name + "";
            Buffer
                = new byte[88];//18
            WriteUInt16((byte)(80), 0, Buffer);
            WriteUInt16(1151, 2, Buffer);

            Buffer[4] = 2;
            WriteUInt32(FlowerID, 8, Buffer);
            Buffer[16] = 1;
            Buffer[24] = 1;
            Buffer[32] = 1;

            WriteUInt32(uint.Parse(UID), 40, Buffer);
            WriteUInt32(uint.Parse(UID), 44, Buffer);
            //Buffer[17] = 1;//13
            // Buffer[18] = (byte)(send.Length & 255);
            for (int i = 0; i < send.Length; i++)
            {
                try
                {
                    Buffer[48 + i] = Convert.ToByte(send[i]);
                    Buffer[48 + i + 16] = Convert.ToByte(send[i]);

                }
                catch { }
            }
        }
        public byte[] ThePacket()
        {
            return Buffer;
        }
    }
how to adit it