[Request]Guides

09/24/2008 17:11 pauldexter#91
Protection for same gender marriage
Code:
                            if (AttackType == 8)//Marriage Proposal
                            {
                                fixed (byte* Ptr = Data)
                                {
                                    uint TargetUID = *(uint*)(Ptr + 12);
                                    Character Target = (Character)World.AllChars[TargetUID];
                                    *(uint*)(Ptr + 8) = MyChar.UID;
                                    {
                                        if (MyChar.Model == 2001 || MyChar.Model == 2002)
                                        {
                                            if (Target.Model == 1003 || Target.Model == 1004)
                                            {
                                                Target.MyClient.SendPacket(Data);
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                        if (MyChar.Model == 1003 || MyChar.Model == 1004)
                                        {
                                            if (Target.Model == 2001 || Target.Model == 2002)
                                            {
                                                Target.MyClient.SendPacket(Data);
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                    }
                                }
                            }
                            if (AttackType == 9)//Marriage Accept
                            {
                                fixed (byte* Ptr = Data)
                                {
                                    uint UID = *(uint*)(Ptr + 12);
                                    Character Char = (Character)World.AllChars[UID];
                                    {
                                        if (Char.Model == 2001 || Char.Model == 2002)
                                        {
                                            if (MyChar.Model == 1003 || MyChar.Model == 1004)
                                            {
                                                Char.Spouse = MyChar.Name;
                                                MyChar.Spouse = Char.Name;
                                                MyChar.SaveSpouse();
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                        if (Char.Model == 1003 || Char.Model == 1004)
                                        {
                                            if (MyChar.Model == 2001 || MyChar.Model == 2002)
                                            {
                                                Char.Spouse = MyChar.Name;
                                                MyChar.Spouse = Char.Name;
                                                MyChar.SaveSpouse();
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                    }
                                }
                            }
hope this is valid
09/24/2008 17:24 Kratos59#92
I'm french, for understant how i can put the code, i need a detail where this code i can put.

Example :
Quote:
Originally Posted by Hayz
public static byte[] MarriageMouse(uint CharUID)
{
byte[] Mouse = new byte[24];
fixed (byte* Ptr = Mouse)
{
*(ushort*)(Ptr + 0) = 24;
*(ushort*)(Ptr + 2) = 1010;
*(uint*)(Ptr + 8) = CharUID;
*(uint*)(Ptr + 12) = 1067;
*(uint*)(Ptr + 22) = 116;
return Mouse;
}
}
Where ? in packet.cs ? Client.cs ?

And that : Client.Send(Packets.MarriageMouse(Client.Char.UID) ); i dont know where ^^

Thank u for helping
09/24/2008 17:53 pauldexter#93
@Kratos59
thats in the Packet.cs and the one is in the Client.cs

im still looking how can a player see his/her spouse in the Status option
09/24/2008 18:03 © Haydz#94
Quote:
Originally Posted by pauldexter View Post
@Kratos59
thats in the Packet.cs and the one is in the Client.cs

im still looking how can a player see his/her spouse in the Status option
Search the Source for string Spuse = "None"; and thats your problem... i explained all the char info packets will need changing cause they are locally defined as "None"; instead of Client.Char.Spouse
so change it to that :P
09/24/2008 18:20 Kratos59#95
Ah i see ^^

i have add : public static byte[] MarriageMouse(uint CharUID)
{
byte[] Mouse = new byte[24];
fixed (byte* Ptr = Mouse)
{
*(ushort*)(Ptr + 0) = 24;
*(ushort*)(Ptr + 2) = 1010;
*(uint*)(Ptr + 8) = CharUID;
*(uint*)(Ptr + 12) = 1067;
*(uint*)(Ptr + 22) = 116;
return Mouse;
}
}

in packet.cs it's good.

But a error code : Client.Send(Packets.MarriageMouse(Client.Char.UID) ); in client cs.

then for fast ^^ you can juste modify for me and it's fix ^^ :

if (Control == 2)
{
SendPacket(General.MyPackets.NPCSay("Cliquez a votre amoureux(se) pour demander le mariage."));
SendPacket(General.MyPackets.NPCLink("OK", 4));
SendPacket(General.MyPackets.NPCSetFace(30));
SendPacket(General.MyPackets.NPCFinish());
}
if (Control == 4)
/*Marriage Packet
const uint dwUnknown = 0x0000042B;
DataPacket Data = new DataPacket(null);
Data.ID = DataIDs.MarriageMouse;
Data.UID = Client.Entity.UID;
Data.lParam = dwUnknown;
MarriageMouse = 0x74;
PacketType = 0x3f2;*/

In control 4 for mouse packet ^^

thank u for helping :)
09/24/2008 18:33 pauldexter#96
i found string Spouse = "None" in Packet.cs but still no happen when i changed it
i already add an row in the character table name Spouse

thats only my problem and the firework effect after the marriage, hehe
09/24/2008 19:12 © Haydz#97
Quote:
Originally Posted by pauldexter View Post
i found string Spouse = "None" in Packet.cs but still no happen when i changed it
i already add an row in the character table name Spouse

thats only my problem and the firework effect after the marriage, hehe
theres more than one that needs changing
09/24/2008 20:42 pegaeu#98
what is variables for marriage?
09/24/2008 20:44 YukiXian#99
Quote:
Originally Posted by © Haydz View Post
theres more than one that needs changing
If there's more needed to change than only change the string Spouse = "None", Could you please tell us what to change? :handsdown:
09/24/2008 20:55 stephanyd#100
lol.. yep cause when i click accept on invitation i can't see spouse name .;)
09/24/2008 21:10 Brun0_#101
Quote:
Originally Posted by stephanyd View Post
lol.. yep cause when i click accept on invitation i can't see spouse name .;)
u fix the error Client.Char? :D
09/25/2008 00:14 tao4229#102
Quote:
Originally Posted by © Haydz View Post
hmmm i may be wrong but if you decrypt the monster.dat file in the Ini folder im sure theres a Size= variable in there... try changing that and then encrypting again... however i may be wrong cause ive never tested it
I meant server side you can't change the size, you can change it client sided(and distribute a patch), but you can't make it bigger in the server.
09/25/2008 02:47 pauldexter#103
This is my code:
Code:
        public static byte[] MarriageMouse(uint CharUID)
        {
            byte[] Mouse = new byte[24];
            fixed (byte* Ptr = Mouse)
            {
                *(ushort*)(Ptr + 0) = 24;
                *(ushort*)(Ptr + 2) = 1010;
                *(uint*)(Ptr + 8) = CharUID;
                *(uint*)(Ptr + 12) = 1067;
                *(uint*)(Ptr + 22) = 116;
                return Mouse;
            }
        }
Code:
                            if (AttackType == 8)//Marriage Proposal
                            {
                                fixed (byte* Ptr = Data)
                                {
                                    uint TargetUID = *(uint*)(Ptr + 12);
                                    Character Target = (Character)World.AllChars[TargetUID];
                                    *(uint*)(Ptr + 8) = MyChar.UID;
                                    {
                                        if (MyChar.Model == 2001 || MyChar.Model == 2002)
                                        {
                                            if (Target.Model == 1003 || Target.Model == 1004)
                                            {
                                                if (Target.Spouse == "")
                                                {
                                                    Target.MyClient.SendPacket(Data);
                                                }
                                                else
                                                {
                                                    SendPacket(General.MyPackets.NPCSay(Target.Name + " has already an Spouse."));
                                                    SendPacket(General.MyPackets.NPCLink("Ok.", 255));
                                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                                    SendPacket(General.MyPackets.NPCFinish());
                                                }
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                        if (MyChar.Model == 1003 || MyChar.Model == 1004)
                                        {
                                            if (Target.Model == 2001 || Target.Model == 2002)
                                            {
                                                if (Target.Spouse == "")
                                                {
                                                    Target.MyClient.SendPacket(Data);
                                                }
                                                else
                                                {
                                                    SendPacket(General.MyPackets.NPCSay(Target.Name + " has already an Spouse."));
                                                    SendPacket(General.MyPackets.NPCLink("Ok.", 255));
                                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                                    SendPacket(General.MyPackets.NPCFinish());
                                                }
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                    }
                                }
                            }
                            if (AttackType == 9)//Marriage Accept
                            {
                                fixed (byte* Ptr = Data)
                                {
                                    uint UID = *(uint*)(Ptr + 12);
                                    Character Char = (Character)World.AllChars[UID];
                                    {
                                        if (Char.Model == 2001 || Char.Model == 2002)
                                        {
                                            if (MyChar.Model == 1003 || MyChar.Model == 1004)
                                            {
                                                Char.Spouse = MyChar.Name;
                                                MyChar.Spouse = Char.Name;
                                                MyChar.SaveSpouse();
                                                Char.SaveSpouse();
                                                World.SendMsgToAll(Char.Name + " and " + MyChar.Name + " has been promoted as husband and wife!", "LoveStone", 2011);
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                        if (Char.Model == 1003 || Char.Model == 1004)
                                        {
                                            if (MyChar.Model == 2001 || MyChar.Model == 2002)
                                            {
                                                Char.Spouse = MyChar.Name;
                                                MyChar.Spouse = Char.Name;
                                                MyChar.SaveSpouse();
                                                Char.SaveSpouse();
                                                World.SendMsgToAll(Char.Name + " and " + MyChar.Name + " has been promoted as husband and wife!", "LoveStone", 2011);
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                    }
                                }
                            }
Code:
                            if (CurrentNPC == 390)
                            {
                                if (MyChar.Spouse == "")
                                {
                                    SendPacket(General.MyPackets.NPCSay("Do you wish to propose to your sweetheart?"));
                                    SendPacket(General.MyPackets.NPCSay("Remember that marriage is a serious commitment, do not enter into it lightly."));
                                    SendPacket(General.MyPackets.NPCLink("Yes I want to propose", 1));
                                    SendPacket(General.MyPackets.NPCLink("Nooo I'm not ready", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("You have already spouse."));
                                    SendPacket(General.MyPackets.NPCLink("Sorry", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                            }
Code:
                            if (CurrentNPC == 390)
                            {
                                if (Control == 1)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Click on your sweetheart to propose to them"));
                                    SendPacket(General.MyPackets.NPCLink("OK", 2));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 2)
                                {
                                    MyChar.MyClient.SendPacket(Packets.MarriageMouse(MyChar.UID));
                                }
                            }
Code:
        public void SaveSpouse()
        {
            if (MyClient.There)
                if (MyClient.Online)
                    DataBase.SaveSpouse(this);
        }
Code:
        public string Spouse = "";
Code:
                    Charr.Spouse = (string)DR["Spouse"];
Code:
        public static void SaveSpouse(Character Charr)
        {
            try
            {
                MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `Spouse` = '" + Charr.Spouse + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);
                Command.ExecuteNonQuery();
            }
            catch (Exception Exc)
            {
                General.WriteLine(Convert.ToString(Exc));
                Connection.Close();
                Connect("username(mysql)", "password(mysql)");
                if (World.SaveAllChars())
                {
                    General.WriteLine("Connection to mysql server reinitiated");
                }
                else
                {
                    General.WriteLine("Connection Error, server restarting! " + DateTime.Now);
                    General.ServerRestart();
                }
            }
        }
i don't need someone tell me where to put all these codes, figure it out yourself

i already add a row in database.

almost finish, i just need the one that you can show your spouse in the status
09/25/2008 03:07 stephanyd#104
Quote:
Originally Posted by pauldexter View Post
This is my code:
Code:
        public static byte[] MarriageMouse(uint CharUID)
        {
            byte[] Mouse = new byte[24];
            fixed (byte* Ptr = Mouse)
            {
                *(ushort*)(Ptr + 0) = 24;
                *(ushort*)(Ptr + 2) = 1010;
                *(uint*)(Ptr + 8) = CharUID;
                *(uint*)(Ptr + 12) = 1067;
                *(uint*)(Ptr + 22) = 116;
                return Mouse;
            }
        }
Code:
                            if (AttackType == 8)//Marriage Proposal
                            {
                                fixed (byte* Ptr = Data)
                                {
                                    uint TargetUID = *(uint*)(Ptr + 12);
                                    Character Target = (Character)World.AllChars[TargetUID];
                                    *(uint*)(Ptr + 8) = MyChar.UID;
                                    {
                                        if (MyChar.Model == 2001 || MyChar.Model == 2002)
                                        {
                                            if (Target.Model == 1003 || Target.Model == 1004)
                                            {
                                                if (Target.Spouse == "")
                                                {
                                                    Target.MyClient.SendPacket(Data);
                                                }
                                                else
                                                {
                                                    SendPacket(General.MyPackets.NPCSay(Target.Name + " has already an Spouse."));
                                                    SendPacket(General.MyPackets.NPCLink("Ok.", 255));
                                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                                    SendPacket(General.MyPackets.NPCFinish());
                                                }
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                        if (MyChar.Model == 1003 || MyChar.Model == 1004)
                                        {
                                            if (Target.Model == 2001 || Target.Model == 2002)
                                            {
                                                if (Target.Spouse == "")
                                                {
                                                    Target.MyClient.SendPacket(Data);
                                                }
                                                else
                                                {
                                                    SendPacket(General.MyPackets.NPCSay(Target.Name + " has already an Spouse."));
                                                    SendPacket(General.MyPackets.NPCLink("Ok.", 255));
                                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                                    SendPacket(General.MyPackets.NPCFinish());
                                                }
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                    }
                                }
                            }
                            if (AttackType == 9)//Marriage Accept
                            {
                                fixed (byte* Ptr = Data)
                                {
                                    uint UID = *(uint*)(Ptr + 12);
                                    Character Char = (Character)World.AllChars[UID];
                                    {
                                        if (Char.Model == 2001 || Char.Model == 2002)
                                        {
                                            if (MyChar.Model == 1003 || MyChar.Model == 1004)
                                            {
                                                Char.Spouse = MyChar.Name;
                                                MyChar.Spouse = Char.Name;
                                                MyChar.SaveSpouse();
                                                Char.SaveSpouse();
                                                World.SendMsgToAll(Char.Name + " and " + MyChar.Name + " has been promoted as husband and wife!", "LoveStone", 2011);
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                        if (Char.Model == 1003 || Char.Model == 1004)
                                        {
                                            if (MyChar.Model == 2001 || MyChar.Model == 2002)
                                            {
                                                Char.Spouse = MyChar.Name;
                                                MyChar.Spouse = Char.Name;
                                                MyChar.SaveSpouse();
                                                Char.SaveSpouse();
                                                World.SendMsgToAll(Char.Name + " and " + MyChar.Name + " has been promoted as husband and wife!", "LoveStone", 2011);
                                            }
                                            else
                                            {
                                                SendPacket(General.MyPackets.NPCSay("Only girl and boy can be marriage."));
                                                SendPacket(General.MyPackets.NPCLink("I see.", 255));
                                                SendPacket(General.MyPackets.NPCSetFace(30));
                                                SendPacket(General.MyPackets.NPCFinish());
                                            }
                                        }
                                    }
                                }
                            }
Code:
                            if (CurrentNPC == 390)
                            {
                                if (MyChar.Spouse == "")
                                {
                                    SendPacket(General.MyPackets.NPCSay("Do you wish to propose to your sweetheart?"));
                                    SendPacket(General.MyPackets.NPCSay("Remember that marriage is a serious commitment, do not enter into it lightly."));
                                    SendPacket(General.MyPackets.NPCLink("Yes I want to propose", 1));
                                    SendPacket(General.MyPackets.NPCLink("Nooo I'm not ready", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                else
                                {
                                    SendPacket(General.MyPackets.NPCSay("You have already spouse."));
                                    SendPacket(General.MyPackets.NPCLink("Sorry", 255));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                            }
Code:
                            if (CurrentNPC == 390)
                            {
                                if (Control == 1)
                                {
                                    SendPacket(General.MyPackets.NPCSay("Click on your sweetheart to propose to them"));
                                    SendPacket(General.MyPackets.NPCLink("OK", 2));
                                    SendPacket(General.MyPackets.NPCSetFace(30));
                                    SendPacket(General.MyPackets.NPCFinish());
                                }
                                if (Control == 2)
                                {
                                    MyChar.MyClient.SendPacket(Packets.MarriageMouse(MyChar.UID));
                                }
                            }
Code:
        public void SaveSpouse()
        {
            if (MyClient.There)
                if (MyClient.Online)
                    DataBase.SaveSpouse(this);
        }
Code:
        public string Spouse = "";
Code:
                    Charr.Spouse = (string)DR["Spouse"];
Code:
        public static void SaveSpouse(Character Charr)
        {
            try
            {
                MySqlCommand Command = new MySqlCommand("UPDATE `Characters` SET `Spouse` = '" + Charr.Spouse + "' WHERE `Account` = '" + Charr.MyClient.Account + "'", Connection);
                Command.ExecuteNonQuery();
            }
            catch (Exception Exc)
            {
                General.WriteLine(Convert.ToString(Exc));
                Connection.Close();
                Connect("username(mysql)", "password(mysql)");
                if (World.SaveAllChars())
                {
                    General.WriteLine("Connection to mysql server reinitiated");
                }
                else
                {
                    General.WriteLine("Connection Error, server restarting! " + DateTime.Now);
                    General.ServerRestart();
                }
            }
        }
i don't need someone tell me where to put all these codes, figure it out yourself

i already add a row in database.

almost finish, i just need the one that you can show your spouse in the status
Ehere do i put this line?
Quote:
Charr.Spouse = (string)DR["Spouse"];
09/25/2008 03:23 pauldexter#105
@stephanyd
don't quote the whole post.

im good now, in DataBase.cs at public static void GetCharInfo

then put the codes in that area there.