Dye/Cloth changing command

Posts 16–30 of 30 · Page 2 of 2
@HoffHorn To change your dye to what you want, look in the XMLs (like dat16.xml I think) for Tex1 and Tex2 values into dyes' objects, then put them after the command in chat. Permission fix for what lol? This command will be removed when I (or someone else) fixes the dyes/cloths items.
Quote Originally Posted by Trapped View Post
@HoffHorn To change your dye to what you want, look in the XMLs (like dat16.xml I think) for Tex1 and Tex2 values into dyes' objects, then put them after the command in chat. Permission fix for what lol? This command will be removed when I (or someone else) fixes the dyes/cloths items.
I mean like only be able to spawn stuff if your admin.
Quote Originally Posted by HoffHorn View Post
I mean like only be able to spawn stuff if your admin.
Code:
 &&
                            CmdReqAdmin() && args.Length >= 1)
You navigate to the db folder in your servers one, then go to data. dat16 is the one for one-color cloths, dat24 is the one for all other cloths. The hex code is given there.

Trapped, you ninja :P
@HoffHorn The permission system is already implemented, just disabled.
I completly don't get that, don't really know where to paste everything, i got the programs the express and all, but can you do a video tutorial please?
Quote Originally Posted by Schev View Post
I completly don't get that, don't really know where to paste everything, i got the programs the express and all, but can you do a video tutorial please?
No, sorry.
Quote Originally Posted by Schev View Post
I completly don't get that, don't really know where to paste everything, i got the programs the express and all, but can you do a video tutorial please?
Same, usually I have no problem with anything from him but this one really gets me when I try to rebuild.
Don't use these commands, spawn Dye/Cloth items instead.
Quote Originally Posted by Trapped View Post
Edits your actual dye (1 is the body one, 2 is the accessory) on the DB and on char (no need to nexus). You need to enter the value "Tex#" (#=1/2) in the dyes/cloths XMLs.
Just add this to the commands:
Code:
else if (cmd.Equals("dye1", StringComparison.OrdinalIgnoreCase))
            {
                int converted = dyes_hextointmod.hextoint(args[0].ToString(), false);
                using (var db1 = new Database())
                {
                    using (var mysqlcommand = db1.CreateQuery())
                    {
                        mysqlcommand.CommandText = "UPDATE characters SET tex1 = @tex1 WHERE accId=@accId AND charId=@charId AND charId=@charId;";
                        mysqlcommand.Parameters.AddWithValue("@accId", psr.Account.AccountId);
                        mysqlcommand.Parameters.AddWithValue( @tex1", converted);
                        mysqlcommand.Parameters.AddWithValue("@charId", psr.Character.CharacterId);
                        if (mysqlcommand.ExecuteNonQuery() > 0)
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Modified dye!"
                            });
                        else if (mysqlcommand.ExecuteNonQuery() == -1)
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Modified dye!"
                            });
                        else
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Error!"
                            });
                    }
                };
                psr.Player.Texture1 = converted;
                UpdateCount++;
            }
            else if (cmd.Equals("cloth1", StringComparison.OrdinalIgnoreCase))
            {
                int converted = dyes_hextointmod.hextoint(args[0].ToString(), true);
                using (var db1 = new Database())
                {
                    using (var mysqlcommand = db1.CreateQuery())
                    {
                        mysqlcommand.CommandText = "UPDATE characters SET tex1 = @tex1 WHERE accId=@accId AND charId=@charId AND charId=@charId;";
                        mysqlcommand.Parameters.AddWithValue("@accId", psr.Account.AccountId);
                        mysqlcommand.Parameters.AddWithValue( @tex1", converted);
                        mysqlcommand.Parameters.AddWithValue("@charId", psr.Character.CharacterId);
                        if (mysqlcommand.ExecuteNonQuery() > 0)
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Modified cloth!"
                            });
                        else if (mysqlcommand.ExecuteNonQuery() == -1)
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Modified cloth!"
                            });
                        else
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Error!"
                            });
                    }
                };
                psr.Player.Texture1 = converted;
                UpdateCount++;
            }
            else if (cmd.Equals("dye2", StringComparison.OrdinalIgnoreCase))
            {
                int converted = dyes_hextointmod.hextoint(args[0].ToString(), false);
                using (var db1 = new Database())
                {
                    using (var mysqlcommand = db1.CreateQuery())
                    {
                        mysqlcommand.CommandText = "UPDATE characters SET tex2 = @tex2 WHERE accId=@accId AND charId=@charId;";
                        mysqlcommand.Parameters.AddWithValue("@accId", psr.Account.AccountId);
                        mysqlcommand.Parameters.AddWithValue( @tex2", converted);
                        mysqlcommand.Parameters.AddWithValue("@charId", psr.Character.CharacterId);
                        if (mysqlcommand.ExecuteNonQuery() > 0)
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Modified dye!"
                            });
                        else if (mysqlcommand.ExecuteNonQuery() == -1)
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Modified dye!"
                            });
                        else
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Error!"
                            });
                    }
                };
                psr.Player.Texture2 = converted;
                UpdateCount++;
            }
            else if (cmd.Equals("cloth2", StringComparison.OrdinalIgnoreCase))
            {
                int converted = dyes_hextointmod.hextoint(args[0].ToString(), true);
                using (var db1 = new Database())
                {
                    using (var mysqlcommand = db1.CreateQuery())
                    {
                        mysqlcommand.CommandText = "UPDATE characters SET tex2 = @tex2 WHERE accId=@accId AND charId=@charId;";
                        mysqlcommand.Parameters.AddWithValue("@accId", psr.Account.AccountId);
                        mysqlcommand.Parameters.AddWithValue( @tex2", converted);
                        mysqlcommand.Parameters.AddWithValue("@charId", psr.Character.CharacterId);
                        if (mysqlcommand.ExecuteNonQuery() > 0)
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Modified cloth!"
                            });
                        else if (mysqlcommand.ExecuteNonQuery() == -1)
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Modified cloth!"
                            });
                        else
                            psr.SendPacket(new TextPacket()
                            {
                                BubbleTime = 0,
                                Stars = -1,
                                Name = "",
                                Text = "Error!"
                            });
                    }
                };
                psr.Player.Texture2 = converted;
                UpdateCount++;
            }
You will need that new class too (Rightclick on project>Add Item>Class>call it dyes_hextointmod), copypaste that code:
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace db
{
    static public class dyes_hextointmod
    {
        public static int hextoint(String hex, bool cloth)
        {
            int converted = 0;
            if (hex.StartsWith("0x"))
            {
                hex = hex.Substring(2);
                if (cloth == true)
                    hex = "0" + hex;
                converted = Convert.ToInt32(hex, 16);
            }
            else
                if (cloth == true)
                    hex = "0" + hex;
                converted = Convert.ToInt32(hex, 16);
            return converted;
        }
    }
}
When you say add this to the commands. Where is that file located? Ex. Wserver>Realm>Entities>Player>>Player.Chat.cs (Thats just an example)
I need to know where to put the first line of code to test. thats what I have been wanting from PServer is dyes so if you could help me that would be great!
@Trapped thanks
@Aceaku1 You no more need these commands. Just /give yourself the dye/cloth items.
This Comment is deleted
Quote Originally Posted by jlr2_08 View Post
How do i make a new Dye?? I mean the texture also... @Trapped
You'd have to edit the client.
what do i program do i use?? @Trapped SOthink??? i can't locate the dye color or the dye.. just the SPRITE of the dye
Quote Originally Posted by jlr2_08 View Post
what do i program do i use?? @Trapped SOthink??? i can't locate the dye color or the dye.. just the SPRITE of the dye
Ah, dunno, I'm a C (and derivates) developer, not an ActionScript/Flash one.
Posts 16–30 of 30 · Page 2 of 2
This thread is closed for replies.

Similar Threads

Tags for this Thread

None

Need help?