[Help] CoEmu v2 GuildDirector

10/11/2009 02:09 Jresyn#1
Well, I've looked all over... I tried to make this NPC on my own but I'm still a novice at C#.

This is as far as I got on my own.
I'm trying to make the Create Guild function...
Code:
#region GuildDirector
                case 10003:
                    {
                        if (LinkBack == 0)
                        {
                            Text("Greetings! I am the guild director, in charge of administrating and managing guilds. What business do you have with me?", CSocket);
                            Link("Create a guild", 1, CSocket);
                            Link("Disband my guild", 2, CSocket);
                            Link("Donate money", 3, CSocket);
                            Link("Pass my leadership", 4, CSocket);
                            Link("Assign Deputy Guild Leader", 5, CSocket);
                            Link("Remove sb. from office", 6, CSocket);
                            Link("Inquire about a guilde", 7, CSocket);
                            Link("Others", 8, CSocket);
                            Face(30, CSocket);
                            End(CSocket);
                        }
                    }
#endregion
I thought I could do something like
Code:
 public static void NewGuild(string Name, int Client)
        {
            MySqlCommand Cmd = new MySqlCommand("INSERT INTO guilds(Name, Leader) VALUES(" + Name + "," + Client + "", DatabaseConnection.NewConnection());
            Cmd.ExecuteNonQuery();
            Cmd.Connection.Close();
            Cmd.Connection.Dispose();
            Cmd.Dispose();
        }
in the Database.cs but I'm not too sure if that's correct...
Then having
Code:
if (LinkBack == 1)
              {
                   Text("Please input the desired Guild name", CSocket);
                   Input(3, CSocket);
                   Database.Database.NewGuild(Name, Client);
                   Face(30, CSocket);
                   End(CSocket);
              }
Or something to that effect... If anyone has done this already could you give me some hints/tips if I'm on the right path or possibly help me entirely?

Thanks in advance

-Jresyn
10/11/2009 02:42 ImmortalYashi#2
The right syntax should be :
else if (LinkBack == 1)
{
Text("Please input the desired Guild name.", CSocket);
Input("something here", 3, CSocket);
Database.Database.NewGuild(Name, Client);
Face(30, CSocket);
End(CSocket);
}
10/11/2009 02:48 Jresyn#3
Ok, so am I going in the right direction with this?
10/11/2009 02:52 ImmortalYashi#4
Pretty much yes. But you need the packets and the packet structure and the handlers for it to eh?

Cya'round,
Yashi.
10/11/2009 03:20 Jresyn#5
So does this mean I have to sniff the packets myself and figure out the structure on my own?

Or is this posted on the forums somewhere?

If anyone cares to help me on this it'd be appreciated :D

Edit: I actually did some more searching... and found a thread on this D=...

Thanks for your help though Yashi :D
10/11/2009 09:58 ImmortalYashi#6
Press thanks if i helped you out.

Cya'round,
Yashi.
10/11/2009 17:15 samehvan#7
Quote:
Originally Posted by Jresyn View Post
Well, I've looked all over... I tried to make this NPC on my own but I'm still a novice at C#.

This is as far as I got on my own.
I'm trying to make the Create Guild function...
Code:
#region GuildDirector
                case 10003:
                    {
                        if (LinkBack == 0)
                        {
                            Text("Greetings! I am the guild director, in charge of administrating and managing guilds. What business do you have with me?", CSocket);
                            Link("Create a guild", 1, CSocket);
                            Link("Disband my guild", 2, CSocket);
                            Link("Donate money", 3, CSocket);
                            Link("Pass my leadership", 4, CSocket);
                            Link("Assign Deputy Guild Leader", 5, CSocket);
                            Link("Remove sb. from office", 6, CSocket);
                            Link("Inquire about a guilde", 7, CSocket);
                            Link("Others", 8, CSocket);
                            Face(30, CSocket);
                            End(CSocket);
                        }
                    }
#endregion
I thought I could do something like
Code:
 public static void NewGuild(string Name, int Client)
        {
            MySqlCommand Cmd = new MySqlCommand("INSERT INTO guilds(Name, Leader) VALUES(" + Name + "," + Client + "", DatabaseConnection.NewConnection());
            Cmd.ExecuteNonQuery();
            Cmd.Connection.Close();
            Cmd.Connection.Dispose();
            Cmd.Dispose();
        }
in the Database.cs but I'm not too sure if that's correct...
Then having
Code:
if (LinkBack == 1)
              {
                   Text("Please input the desired Guild name", CSocket);
                   Input(3, CSocket);
                   Database.Database.NewGuild(Name, Client);
                   Face(30, CSocket);
                   End(CSocket);
              }
Or something to that effect... If anyone has done this already could you give me some hints/tips if I'm on the right path or possibly help me entirely?

Thanks in advance

-Jresyn
1-you have to get the name the player entered first , usually it starts from Data 14 to (Data.length -11) and that would be the name
2-the MySql command should be
Code:
VALUES([COLOR="Red"]'[/COLOR]" + Name + "[COLOR="Red"]'[/COLOR],
Quote:
Originally Posted by Jresyn View Post
Ok, so am I going in the right direction with this?
Quote:
Originally Posted by Jresyn View Post
So does this mean I have to sniff the packets myself and figure out the structure on my own?

Or is this posted on the forums somewhere?

If anyone cares to help me on this it'd be appreciated :D

Edit: I actually did some more searching... and found a thread on this D=...

Thanks for your help though Yashi :D
the data u need is already there and decrypted u just need to convert it from hexa to characters to get the r8 name and then the Client should be CSocket.Client.ID