using System;
using System.Linq;
using System.Data;

using FilterAPI;
using FilterAPI.Networking;

using FilterZone.ZoneNetworking;
using System.Collections.Generic;

namespace FilterZone
{
    internal class Command
    {
        public static void HandleCommand(ZoneClient ClientSocket, String Message, Boolean IgnorePermission = false)
        {
            String[] MessageSplit = Message.Split(' ');

            String Command = MessageSplit[0].Replace("&", "").ToLower();

            Program.SQL.InserttCommand(Program.ZoneID, ClientSocket.sID, Command, Message.Replace(String.Format("&{0}", Command), ""));

            if (Command == "unstuck" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "Unstuck")))
            {
                Int32 X = Convert.ToInt32(Program.MapInfo.Table.Rows.Cast<DataRow>().Where(ItemArray => ItemArray.ItemArray[1].ToString() == ClientSocket.sMap).FirstOrDefault().ItemArray[3]);
                Int32 Y = Convert.ToInt32(Program.MapInfo.Table.Rows.Cast<DataRow>().Where(ItemArray => ItemArray.ItemArray[1].ToString() == ClientSocket.sMap).FirstOrDefault().ItemArray[4]);

                Linkto(ClientSocket, ClientSocket.sMap, X, Y);

                GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "You have been ported to the regen point of your current map.");
            }
            else if (Command == "town" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "Town")))
            {
                String MapIndex = Program.Auth.ConfigValues["ZoneCTownMI"];
                String MapName = Convert.ToString(Program.MapInfo.Table.Rows.Cast<DataRow>().Where(ItemArray => ItemArray.ItemArray[1].ToString() == MapIndex).FirstOrDefault().ItemArray[2]);
                Int32 X = Convert.ToInt32(Program.MapInfo.Table.Rows.Cast<DataRow>().Where(ItemArray => ItemArray.ItemArray[1].ToString() == MapIndex).FirstOrDefault().ItemArray[3]);
                Int32 Y = Convert.ToInt32(Program.MapInfo.Table.Rows.Cast<DataRow>().Where(ItemArray => ItemArray.ItemArray[1].ToString() == MapIndex).FirstOrDefault().ItemArray[4]);

                Linkto(ClientSocket, MapIndex, X, Y);

                GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "You have been ported to {0}. X: {1}. Y: {2}.", MapName, X, Y);
            }
            else if (Command == "spawnmob" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "SpawnMob")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &spawnmob INDEX AMOUNT"); }
                else if (MessageSplit.Length == 2) { Mobbreed(ClientSocket, MessageSplit[1], 1, 0, false, 1); }
                else
                {
                    for (Int32 Counter = 0; Counter < Convert.ToInt32(MessageSplit[2]); Counter++) { Mobbreed(ClientSocket, MessageSplit[1], 1, 0, false, 1); }
                }
            }
            else if (Command == "spawnmobmulti" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "SpawnMobMulti")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &spawnmobmulti INDEX:INDEX2:INDEX3 AMOUNT1:AMOUNT2:AMOUNT3"); }
                else if (!MessageSplit[1].Contains(":")) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Please use: &spawnmob INDEX AMOUNT for single indexs."); }
                else if (MessageSplit.Length == 2)
                {
                    String[] MobNames = MessageSplit[1].Split(':');

                    foreach (String MobName in MobNames) { Mobbreed(ClientSocket, MobName, 1, 0, false, 1); }
                }
                else
                {
                    String[] MobNames = MessageSplit[1].Split(':');
                    String[] MobCounts = MessageSplit[2].Split(':');

                    for (Int32 NameCounter = 0; NameCounter < MobNames.Count(); NameCounter++)
                    {
                        for (Int32 SpawnCounter = 0; SpawnCounter < Convert.ToInt32(MobCounts[NameCounter]); SpawnCounter++) { Mobbreed(ClientSocket, MobNames[NameCounter], 1, 0, false, 1); }
                    }
                }
            }
            else if (Command == "spawnmoball" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "SpawnMobAll")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &spawnmoball INDEX AMOUNT SHOWMESSAGE"); }
                else if (MessageSplit.Length == 2)
                {
                    using (var LocalPacket = new Packet(5, 3))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);
                        LocalPacket.PacketWriter.Write((Int32)1);
                        LocalPacket.PacketWriter.Write(true);
                        LocalPacket.PacketWriter.Write(ClientSocket.sID);

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
                else
                {
                    using (var LocalPacket = new Packet(5, 3))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);
                        LocalPacket.PacketWriter.Write(Convert.ToInt32(MessageSplit[2]));

                        if (MessageSplit.Length == 4)
                        {
                            LocalPacket.PacketWriter.Write(Convert.ToBoolean(MessageSplit[3]));
                            LocalPacket.PacketWriter.Write(ClientSocket.sID);
                        }
                        else
                        {
                            LocalPacket.PacketWriter.Write(true);
                            LocalPacket.PacketWriter.Write(ClientSocket.sID);
                        }

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "spawnmobplayer" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "SpawnMobPlayer")))
            {
                if (MessageSplit.Length == 1 || MessageSplit.Length == 2) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &spawnmobplayer PLAYERNAME INDEX AMOUNT SHOWMESSAGE"); }
                else if (!Program.SQL.GettLoggedInChar(MessageSplit[1])) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", String.Format("{0} is not online.", MessageSplit[1])); }
                else if (MessageSplit.Length == 3)
                {
                    using (var LocalPacket = new Packet(5, 4))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);
                        LocalPacket.PacketWriter.Write(MessageSplit[2]);
                        LocalPacket.PacketWriter.Write((Int32)1);
                        LocalPacket.PacketWriter.Write(true);
                        LocalPacket.PacketWriter.Write(ClientSocket.sID);

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
                else
                {
                    using (var LocalPacket = new Packet(5, 4))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);
                        LocalPacket.PacketWriter.Write(MessageSplit[2]);
                        LocalPacket.PacketWriter.Write(Convert.ToInt32(MessageSplit[3]));

                        if (MessageSplit.Length == 5)
                        {
                            LocalPacket.PacketWriter.Write(Convert.ToBoolean(MessageSplit[4]));
                            LocalPacket.PacketWriter.Write(ClientSocket.sID);
                        }
                        else
                        {
                            LocalPacket.PacketWriter.Write(true);
                            LocalPacket.PacketWriter.Write(ClientSocket.sID);
                        }

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "item" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "Item")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &item INDEX -l HOWMANY -u UPGRADE"); }
                else if (MessageSplit.Length == 2) { Makeitem(ClientSocket, MessageSplit[1]); }
                else if (MessageSplit.Length == 4)
                {
                    if (MessageSplit[2].ToLower() == "-l") { Makeitem(ClientSocket, MessageSplit[1], Convert.ToByte(MessageSplit[3])); }
                    else if (Convert.ToByte(MessageSplit[2]) > 12) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Items cannot be +'d any higher than 12."); }
                    else if (MessageSplit[2].ToLower() == "-u") { Makeitem(ClientSocket, MessageSplit[1], true, Convert.ToByte(MessageSplit[3])); }
                }
                else
                {
                    Byte Amount = 0;
                    Byte Upgrade = 0;

                    if (MessageSplit[2].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[3]); }
                    if (MessageSplit[4].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[5]); }

                    if (MessageSplit[2].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[3]); }
                    if (MessageSplit[4].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[5]); }

                    if (Upgrade > 12) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Items cannot be +'d any higher than 12."); }
                    else { Makeitem(ClientSocket, MessageSplit[1], Amount, Upgrade); }
                }
            }
            else if (Command == "itemall" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "ItemAll")))
            {
                Boolean SendMessage = false;
                Byte Amount = 0;
                Byte Upgrade = 0;
                Boolean ShowMessage = true;

                if (MessageSplit.Length == 1 || MessageSplit.Length == 3) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &itemall INDEX -l HOWMANY -u UPGRADE -s SHOWMESSAGE"); }
                else if (MessageSplit.Length == 2) { SendMessage = true; }
                else if (MessageSplit.Length == 4)
                {
                    SendMessage = true;

                    if (MessageSplit[2].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[3]); }
                    if (MessageSplit[2].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[3]); }
                    if (MessageSplit[2].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[3]); }
                }
                else if (MessageSplit.Length == 6)
                {
                    SendMessage = true;

                    if (MessageSplit[2].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[3]); }
                    if (MessageSplit[2].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[3]); }
                    if (MessageSplit[2].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[3]); }

                    if (MessageSplit[4].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[5]); }
                    if (MessageSplit[4].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[5]); }
                    if (MessageSplit[4].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[5]); }
                }
                else
                {
                    SendMessage = true;

                    if (MessageSplit[2].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[3]); }
                    if (MessageSplit[2].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[3]); }
                    if (MessageSplit[2].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[3]); }

                    if (MessageSplit[4].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[5]); }
                    if (MessageSplit[4].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[5]); }
                    if (MessageSplit[4].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[5]); }

                    if (MessageSplit[6].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[7]); }
                    if (MessageSplit[6].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[7]); }
                    if (MessageSplit[6].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[7]); }
                }

                if (Upgrade > 12) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Items cannot be +'d any higher than 12."); }
                else if (SendMessage)
                {
                    using (var LocalPacket = new Packet(5, 5))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);

                        if (Amount == 0)
                        {
                            LocalPacket.PacketWriter.Write(false);
                            LocalPacket.PacketWriter.Write((Byte)0);
                        }
                        else
                        {
                            LocalPacket.PacketWriter.Write(true);
                            LocalPacket.PacketWriter.Write((Byte)Amount);
                        }

                        if (Upgrade == 0)
                        {
                            LocalPacket.PacketWriter.Write(false);
                            LocalPacket.PacketWriter.Write((Byte)0);
                        }
                        else
                        {
                            LocalPacket.PacketWriter.Write(true);
                            LocalPacket.PacketWriter.Write((Byte)Upgrade);
                        }

                        LocalPacket.PacketWriter.Write(ShowMessage);
                        LocalPacket.PacketWriter.Write(ClientSocket.sID);

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "giveitem" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "GiveItem")))
            {
                Boolean SendMessage = false;
                Byte Amount = 0;
                Byte Upgrade = 0;
                Byte RunAmount = 0;
                Boolean ShowMessage = true;

                if (MessageSplit.Length == 1 || MessageSplit.Length == 2 || MessageSplit.Length == 4) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &giveitem PLAYERNAME INDEX -l HOWMANY -u UPGRADE -s SHOWMESSAGE"); }
                else if (!Program.SQL.GettLoggedInChar(MessageSplit[1])) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", String.Format("{0} is not online.", MessageSplit[1])); }
                else if (MessageSplit.Length == 3) { SendMessage = true; }
                else if (MessageSplit.Length == 5)
                {
                    SendMessage = true;

                    if (MessageSplit[3].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[4]); }
                }
                else if (MessageSplit.Length == 7)
                {
                    SendMessage = true;

                    if (MessageSplit[3].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[4]); }

                    if (MessageSplit[5].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[6]); }
                    if (MessageSplit[5].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[6]); }
                    if (MessageSplit[5].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[6]); }
                    if (MessageSplit[5].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[6]); }
                }
                else if (MessageSplit.Length == 9)
                {
                    SendMessage = true;

                    if (MessageSplit[3].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[4]); }

                    if (MessageSplit[5].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[6]); }
                    if (MessageSplit[5].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[6]); }
                    if (MessageSplit[5].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[6]); }
                    if (MessageSplit[5].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[6]); }

                    if (MessageSplit[7].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[8]); }
                    if (MessageSplit[7].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[8]); }
                    if (MessageSplit[7].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[8]); }
                    if (MessageSplit[7].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[8]); }
                }
                else
                {
                    SendMessage = true;

                    if (MessageSplit[3].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[4]); }
                    if (MessageSplit[3].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[4]); }

                    if (MessageSplit[5].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[6]); }
                    if (MessageSplit[5].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[6]); }
                    if (MessageSplit[5].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[6]); }
                    if (MessageSplit[5].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[6]); }

                    if (MessageSplit[7].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[8]); }
                    if (MessageSplit[7].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[8]); }
                    if (MessageSplit[7].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[8]); }
                    if (MessageSplit[7].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[8]); }

                    if (MessageSplit[9].ToLower() == "-l") { Amount = Convert.ToByte(MessageSplit[10]); }
                    if (MessageSplit[9].ToLower() == "-u") { Upgrade = Convert.ToByte(MessageSplit[10]); }
                    if (MessageSplit[9].ToLower() == "-s") { ShowMessage = Convert.ToBoolean(MessageSplit[10]); }
                    if (MessageSplit[9].ToLower() == "-ra") { RunAmount = Convert.ToByte(MessageSplit[10]); }
                }

                if (Upgrade > 12) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Items cannot be +'d any higher than 12."); }
                else if (SendMessage)
                {
                    using (var LocalPacket = new Packet(5, 6))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);
                        LocalPacket.PacketWriter.Write(MessageSplit[2]);

                        if (Amount == 0)
                        {
                            LocalPacket.PacketWriter.Write(false);
                            LocalPacket.PacketWriter.Write((Byte)0);
                        }
                        else
                        {
                            LocalPacket.PacketWriter.Write(true);
                            LocalPacket.PacketWriter.Write((Byte)Amount);
                        }

                        if (Upgrade == 0)
                        {
                            LocalPacket.PacketWriter.Write(false);
                            LocalPacket.PacketWriter.Write((Byte)0);
                        }
                        else
                        {
                            LocalPacket.PacketWriter.Write(true);
                            LocalPacket.PacketWriter.Write((Byte)Upgrade);
                        }

                        if (RunAmount == 0) { LocalPacket.PacketWriter.Write((Byte)1); }
                        else { LocalPacket.PacketWriter.Write((Byte)RunAmount); }

                        LocalPacket.PacketWriter.Write(ShowMessage);
                        LocalPacket.PacketWriter.Write(ClientSocket.sID);

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "tp" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "Tp")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &tp PLAYER TOPLAYER"); }
                else if (!Program.SQL.GettLoggedInChar(MessageSplit[1])) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", String.Format("{0} is not online.", MessageSplit[1])); }
                else if (MessageSplit.Length == 2) { Pfind(ClientSocket, MessageSplit[1]); }
                else if (!Program.SQL.GettLoggedInChar(MessageSplit[2])) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", String.Format("{0} is not online.", MessageSplit[2])); }
                else
                {
                    using (var LocalPacket = new Packet(5, 7))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);
                        LocalPacket.PacketWriter.Write(MessageSplit[2]);

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "tpall" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "TpAll")))
            {
                if (MessageSplit.Length == 1)
                {
                    using (var LocalPacket = new Packet(5, 8))
                    {
                        LocalPacket.PacketWriter.Write(ClientSocket.sID);

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
                else if (!Program.SQL.GettLoggedInChar(MessageSplit[1])) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", String.Format("{0} is not online.", MessageSplit[1])); }
                else
                {
                    using (var LocalPacket = new Packet(5, 8))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "map" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "Map")))
            {
                Int32 X = 0;
                Int32 Y = 0;
                String TeleportsID = String.Empty;

                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &map MAPINDEX -xy MAPX MAPY -p PLAYER"); }
                else if (MessageSplit.Length == 2) { Linkto(ClientSocket, MessageSplit[1]); }
                else
                {
                    if (MessageSplit[2].ToLower() == "-xy")
                    {
                        X = Convert.ToInt32(MessageSplit[3]);
                        Y = Convert.ToInt32(MessageSplit[4]);
                    }
                    else if (MessageSplit[2].ToLower() == "-p") { TeleportsID = Convert.ToString(MessageSplit[3]); }

                    if (MessageSplit.Length == 7)
                    {
                        if (MessageSplit[2].ToLower() == "-xy") { TeleportsID = Convert.ToString(MessageSplit[6]); }
                        else if (MessageSplit[2].ToLower() == "-p")
                        {
                            X = Convert.ToInt32(MessageSplit[5]);
                            Y = Convert.ToInt32(MessageSplit[6]);
                        }
                    }

                    if (TeleportsID == String.Empty) { Linkto(ClientSocket, MessageSplit[1], X, Y); }
                    else
                    {
                        using (var LocalPacket = new Packet(5, 9))
                        {
                            LocalPacket.PacketWriter.Write(MessageSplit[1]);

                            if (X == 0 && Y == 0)
                            {
                                LocalPacket.PacketWriter.Write(false);
                                LocalPacket.PacketWriter.Write((Int64)0);
                            }
                            else
                            {
                                LocalPacket.PacketWriter.Write(true);
                                LocalPacket.PacketWriter.Write((Int32)X);
                                LocalPacket.PacketWriter.Write((Int32)Y);
                            }

                            LocalPacket.PacketWriter.Write(TeleportsID);

                            Program.LocalClient.SendPacket(LocalPacket);
                        }
                    }
                }
            }
            else if (Command == "abstate" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "Abstate")))
            {
                Int32 Duration = 0;
                Byte Effect = 0;
                String PlayersID = String.Empty;

                if (MessageSplit.Length == 1 || MessageSplit.Length == 3) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &abstate ABSTATEINDEX -d DURATION -p PLAYER -e EFFECTLEVEL"); }
                else if (MessageSplit.Length == 2) { SetAbstate(ClientSocket, MessageSplit[1]); }
                else
                {
                    if (MessageSplit.Length == 4)
                    {
                        if (MessageSplit[2].ToLower() == "-d") { Duration = Convert.ToInt32(MessageSplit[3]); }
                        if (MessageSplit[2].ToLower() == "-e") { Effect = Convert.ToByte(MessageSplit[3]); }
                        if (MessageSplit[2].ToLower() == "-p") { PlayersID = Convert.ToString(MessageSplit[3]); }
                    }
                    else if (MessageSplit.Length == 6)
                    {
                        if (MessageSplit[2].ToLower() == "-d") { Duration = Convert.ToInt32(MessageSplit[3]); }
                        if (MessageSplit[2].ToLower() == "-e") { Effect = Convert.ToByte(MessageSplit[3]); }
                        if (MessageSplit[2].ToLower() == "-p") { PlayersID = Convert.ToString(MessageSplit[3]); }

                        if (MessageSplit[4].ToLower() == "-d") { Duration = Convert.ToInt32(MessageSplit[5]); }
                        if (MessageSplit[4].ToLower() == "-e") { Effect = Convert.ToByte(MessageSplit[5]); }
                        if (MessageSplit[4].ToLower() == "-p") { PlayersID = Convert.ToString(MessageSplit[5]); }
                    }
                    else
                    {
                        if (MessageSplit[2].ToLower() == "-d") { Duration = Convert.ToInt32(MessageSplit[3]); }
                        if (MessageSplit[2].ToLower() == "-e") { Effect = Convert.ToByte(MessageSplit[3]); }
                        if (MessageSplit[2].ToLower() == "-p") { PlayersID = Convert.ToString(MessageSplit[3]); }

                        if (MessageSplit[4].ToLower() == "-d") { Duration = Convert.ToInt32(MessageSplit[5]); }
                        if (MessageSplit[4].ToLower() == "-e") { Effect = Convert.ToByte(MessageSplit[5]); }
                        if (MessageSplit[4].ToLower() == "-p") { PlayersID = Convert.ToString(MessageSplit[5]); }

                        if (MessageSplit[6].ToLower() == "-d") { Duration = Convert.ToInt32(MessageSplit[7]); }
                        if (MessageSplit[6].ToLower() == "-e") { Effect = Convert.ToByte(MessageSplit[7]); }
                        if (MessageSplit[6].ToLower() == "-p") { PlayersID = Convert.ToString(MessageSplit[7]); }
                    }

                    if (PlayersID == String.Empty)
                    {
                        if (Duration == 0 && Effect == 0) { SetAbstate(ClientSocket, MessageSplit[1]); }
                        else if (Duration != 0 && Effect == 0) { SetAbstate(ClientSocket, MessageSplit[1], Duration); }
                        else { SetAbstate(ClientSocket, MessageSplit[1], Duration, Effect); }
                    }
                    else
                    {
                        using (var LocalPacket = new Packet(5, 11))
                        {
                            LocalPacket.PacketWriter.Write(MessageSplit[1]);
                            LocalPacket.PacketWriter.Write((Int32)Duration);
                            LocalPacket.PacketWriter.Write((Byte)Effect);
                            LocalPacket.PacketWriter.Write(PlayersID);

                            Program.LocalClient.SendPacket(LocalPacket);
                        }
                    }
                }
            }
            else if (Command == "kqreward" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "KQReward")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &kqreward KQID PLAYER"); }
                else if (MessageSplit.Length == 2) { KQReward(ClientSocket, Convert.ToByte(MessageSplit[1])); }
                else
                {
                    using (var LocalPacket = new Packet(5, 12))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[2]);
                        LocalPacket.PacketWriter.Write(Convert.ToByte(MessageSplit[1]));

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "clearinv" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "ClearInv")))
            {
                if (MessageSplit.Length == 1)
                {
                    GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &clearinv INVENTORYID PLAYERNAME");
                    GlobalPacket.SendShoutMessageServer(ClientSocket, ".", "0: Guild storage");
                    GlobalPacket.SendShoutMessageServer(ClientSocket, ".", "2: Reward inventory");
                    GlobalPacket.SendShoutMessageServer(ClientSocket, ".", "6: Account storage");
                    GlobalPacket.SendShoutMessageServer(ClientSocket, ".", "8: Equiped inventory");
                    GlobalPacket.SendShoutMessageServer(ClientSocket, ".", "9: Main inventory");
                    GlobalPacket.SendShoutMessageServer(ClientSocket, ".", "12: Minihouse inventory");
                    GlobalPacket.SendShoutMessageServer(ClientSocket, ".", "15: Emotion inventory");
                }
                else
                {
                    Int32 nCharNo = ClientSocket.nCharNo;
                    Int32 nUserNo = ClientSocket.nUserNo;

                    if (MessageSplit.Length == 3)
                    {
                        if (!Program.SQL.sIDTaken(MessageSplit[2]))
                        {
                            GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Character not found.");

                            return;
                        }

                        nCharNo = Program.SQL.GetnCharNoFromsID(MessageSplit[2]);
                        nUserNo = Program.SQL.GetnUserNoFromsID(MessageSplit[2]);
                    }

                    Byte nStorageType = Convert.ToByte(MessageSplit[1]);

                    switch (nStorageType)
                    {
                        case 0:
                            {
                                Int32 nNo = Program.SQL.GetnNoFromnCharNo(nCharNo);

                                Program.SQL.CleartItem(nNo, nStorageType);

                                break;
                            }
                        case 2:
                        case 8:
                        case 9:
                        case 12:
                        case 15:
                            {
                                Program.SQL.CleartItem(nCharNo, nStorageType);

                                break;
                            }
                        case 6:
                            {
                                Program.SQL.CleartItem(nUserNo, nStorageType);

                                break;
                            }
                    }

                    if (MessageSplit.Length != 3) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Inventory {0} has been cleared. Please relog.", nStorageType); }
                    else { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Inventory {0} of {1} has been cleared. Please tell them to relog.", nStorageType, MessageSplit[2]); }
                }
            }
            else if (Command == "disconnect" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "Disconnect")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &disconnect PLAYERNAME SHOWMESSAGE"); }
                else
                {
                    using (var LocalPacket = new Packet(4, 7))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);

                        Boolean ShowMessage = true;

                        if (MessageSplit.Length == 3) { ShowMessage = Convert.ToBoolean(MessageSplit[2]); }

                        if (ShowMessage)
                        {
                            LocalPacket.PacketWriter.Write(true);
                            LocalPacket.PacketWriter.Write("Server");
                            LocalPacket.PacketWriter.Write(String.Format("You have been disconnected by {0}.", ClientSocket.sID));
                        }
                        else
                        {
                            LocalPacket.PacketWriter.Write(false);
                            LocalPacket.PacketWriter.Write("");
                            LocalPacket.PacketWriter.Write("");
                        }

                        Program.LocalClient.SendPacket(LocalPacket);
                    }

                    GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "{0} has been disconnected.", MessageSplit[1]);
                }
            }
            else if (Command == "setlevel" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "SetLevel")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &setlevel LEVEL PLAYER"); }
                else if (Convert.ToByte(MessageSplit[1]) == 0) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "You cannot set your level to 0, your character will bug."); }
                else if (Convert.ToByte(MessageSplit[1]) > 150) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "You cannot level over 150, your character will bug."); }
                else if (MessageSplit.Length == 2)
                {
                    Byte nLevel = Program.SQL.GetnLevelFromsID(ClientSocket.sID);

                    if (Convert.ToByte(MessageSplit[1]) > nLevel) { Levelup(ClientSocket, Convert.ToByte(Convert.ToByte(MessageSplit[1]) - nLevel)); }
                    else
                    {
                        Levelup(ClientSocket, Convert.ToByte(256 - nLevel));
                        Levelup(ClientSocket, Convert.ToByte(MessageSplit[1]));
                    }
                }
                else
                {
                    using (var LocalPacket = new Packet(5, 10))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[2]);
                        LocalPacket.PacketWriter.Write(Convert.ToByte(MessageSplit[1]));

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "runcommand" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "RunCommand")))
            {
                if (MessageSplit.Length == 1 || MessageSplit.Length == 2) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &runcommand PLAYERNAME COMMAND&PARAMETERS"); }
                else
                {
                    using (var LocalPacket = new Packet(5, 13))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);
                        LocalPacket.PacketWriter.Write(Message.Replace(String.Concat(MessageSplit[0], " "), "").Replace(String.Concat(MessageSplit[1], " "), ""));

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "canwalk" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "CanWalk")))
            {
                if (MessageSplit.Length == 1 || MessageSplit.Length == 2) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &CanWalk PLAYERNAME TRUE/FALSE"); }
                else
                {
                    using (var LocalPacket = new Packet(5, 14))
                    {
                        LocalPacket.PacketWriter.Write(MessageSplit[1]);
                        LocalPacket.PacketWriter.Write(Convert.ToBoolean(MessageSplit[2]));

                        Program.LocalClient.SendPacket(LocalPacket);
                    }
                }
            }
            else if (Command == "produceitems" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "ProduceItems")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &ProduceItems PRODUCTID"); }
                else
                {
                    Byte RawRow = 5;
                    Byte QuantityRow = 6;

                    DataRow ProduceRow = Program.Produce.Table.Rows.Cast<DataRow>().Where(ItemArray => Convert.ToUInt16(ItemArray.ItemArray[0]) == Convert.ToUInt16(MessageSplit[1])).FirstOrDefault();

                    for (Byte Counter = 0; Counter < 8; Counter++)
                    {
                        if (Convert.ToString(ProduceRow[RawRow]) != "-")
                        {
                            DataRow ItemRow = Program.ItemInfo.Table.Rows.Cast<DataRow>().Where(ItemArray => Convert.ToString(ItemArray.ItemArray[1]) == Convert.ToString(ProduceRow[RawRow])).FirstOrDefault();

                            UInt16 AmountNeeded = Convert.ToUInt16(ProduceRow[QuantityRow]);
                            Byte SpawnAmount = 1;

                            while (AmountNeeded > SpawnAmount * Convert.ToByte(ItemRow[5])) { SpawnAmount += 1; }

                            for (Byte SpawnCounter = 0; SpawnCounter < SpawnAmount; SpawnCounter++) { Makeitem(ClientSocket, Convert.ToString(ProduceRow[RawRow])); }
                        }

                        RawRow += 2;
                        QuantityRow += 2;
                    }
                }
            }
            else if (Command == "leaveguild" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "LeaveGuild")))
            {
                if (ClientSocket.NeedGDC)
                {
                    GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "To leave your guild please type the command agian.");

                    ClientSocket.NeedGDC = false;
                }
                else if (!Program.SQL.InGuild(ClientSocket.nCharNo)) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "You are not in a guild."); }
                else
                {
                    Program.SQL.RemoveFromtGuildMember(ClientSocket.nCharNo);

                    GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Your guild has been removed please relog.");

                    ClientSocket.NeedGDC = true;
                }
            }
            else if (Command == "hideplayers" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "HidePlayers")))
            {
                if (Program.HidePlayerMaps.Table.Rows.Cast<DataRow>().Where(ItemArray => Convert.ToString(ItemArray.ItemArray[0]) == ClientSocket.sMap).FirstOrDefault() == null) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Sorry the command &hideplayers is not enabled in this map."); }
                else
                {
                    GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "All players are now hidden in this map also the chat has been disabled due to the way fiesta works. Please note that once you change map again you will have to type the command again.");

                    ClientSocket.ShowPlayers = false;
                    ClientSocket.SPMC = false;

                    Pfind(ClientSocket, ClientSocket.sID);
                }
            }
            else if (Command == "divorce" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "Divorce")))
            {
                if (Program.SQL.DeleteMarriage(ClientSocket.nCharNo)) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "You have been divorced or unengaged from your partner. Please relog."); }
                else { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "You are not married to anyone. Sad life :(."); }
            }
            else if (Command == "migratezone" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "MigrateZone")))
            {
                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &MigrateZone MAPINDEX"); }
                else
                {
                    String MapIndex = MessageSplit[1];
                    String MapName = Convert.ToString(Program.MapInfo.Table.Rows.Cast<DataRow>().Where(ItemArray => ItemArray.ItemArray[1].ToString() == MapIndex).FirstOrDefault().ItemArray[2]);
                    Int32 X = Convert.ToInt32(Program.MapInfo.Table.Rows.Cast<DataRow>().Where(ItemArray => ItemArray.ItemArray[1].ToString() == MapIndex).FirstOrDefault().ItemArray[3]);
                    Int32 Y = Convert.ToInt32(Program.MapInfo.Table.Rows.Cast<DataRow>().Where(ItemArray => ItemArray.ItemArray[1].ToString() == MapIndex).FirstOrDefault().ItemArray[4]);

                    foreach (ZoneClient ZClient in Program.ZoneClients.Values.Where(sID => sID.sID != ClientSocket.sID))
                    {
                        GlobalPacket.SendShoutMessageServer(ZClient, "Server", String.Format("{0} has sent everyone in the zone you are currently in to {1}.", ClientSocket.sID, MapName));

                        Linkto(ZClient, MapIndex, X, Y);
                    }
                }
            }
            else if (Command == "portalnpc" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "PortalNPC")))
            {
                Dictionary<Byte, UInt16> ItemIDs = new Dictionary<Byte, UInt16>();

                for (Int32 Counter = 0; Counter < 256; Counter++)
                {
                    DataRow PortalNPCRow;

                    if ((PortalNPCRow = Program.PortalNPC.Table.Rows.Cast<DataRow>().Where(ItemArray => Convert.ToByte(ItemArray.ItemArray[0]) == Counter).FirstOrDefault()) != null) { ItemIDs.Add(Convert.ToByte(PortalNPCRow.ItemArray[0]), Convert.ToUInt16(PortalNPCRow.ItemArray[1])); }
                }

                GlobalPacket.Send1TabNPC(ClientSocket, 0, ItemIDs);
            }
            else if (Command == "portablenpc" && (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "PortableNPC")))
            {
                DataRow[] PortableNPCItems;

                if (MessageSplit.Length == 1) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Useage: &PortableNPC NPCID"); }
                else if ((PortableNPCItems = Program.PortableNPCs.Table.Rows.Cast<DataRow>().Where(ItemArray => Convert.ToByte(ItemArray.ItemArray[0]) == Convert.ToByte(MessageSplit[1])).ToArray()).Count() == 0) { GlobalPacket.SendShoutMessageServer(ClientSocket, "Server", "Could not find a portable NPC with ID {0}.", MessageSplit[1]); }
                else
                {
                    Dictionary<Byte, UInt16> ItemIDs = new Dictionary<Byte, UInt16>();

                    foreach (DataRow PortableNPCItem in PortableNPCItems) { ItemIDs.Add(Convert.ToByte(PortableNPCItem.ItemArray[1]), Convert.ToUInt16(PortableNPCItem.ItemArray[2])); }

                    GlobalPacket.Send1TabNPC(ClientSocket, 0, ItemIDs);
                }
            }
            else
            {
                if (IgnorePermission || Program.SQL.HasPermission(ClientSocket.nCharNo, "OtherCommands")) { GlobalPacket.SendNormalMessageClient(ClientSocket, Message); }
            }
        }

        public static void Mobbreed(ZoneClient ClientSocket, String MobIndex, Byte MobAmount, Byte RegenSec, Boolean IsFamily, Byte RegenNumber) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&mobbreed {0} {1} {2} {3} {4}", MobIndex, MobAmount, RegenSec, Convert.ToByte(IsFamily), RegenNumber)); }

        public static void Mobbreed(ZoneClient ClientSocket, String MobIndex, Byte MobAmount, Byte RegenSec, Boolean IsFamily, Byte RegenNumber, Byte MobLevel) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&mobbreed {0} {1} {2} {3} {4} - - {5}", MobIndex, MobAmount, RegenSec, Convert.ToByte(IsFamily), RegenNumber, MobLevel)); }

        public static void Makeitem(ZoneClient ClientSocket, String ItemIndex) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&makeitem {0}", ItemIndex)); }

        public static void Makeitem(ZoneClient ClientSocket, String ItemIndex, Byte Amount) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&makeitem {0} -l{1}", ItemIndex, Amount)); }

        public static void Makeitem(ZoneClient ClientSocket, String ItemIndex, Boolean IsUpgrade, Byte Upgrade) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&makeitem {0} -u{1}", ItemIndex, Upgrade)); }

        public static void Makeitem(ZoneClient ClientSocket, String ItemIndex, Byte Amount, Byte Upgrade) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&makeitem {0} -l{1} -u{2}", ItemIndex, Amount, Upgrade)); }

        public static void Pfind(ZoneClient ClientSocket, String sID) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&pfind {0}", sID)); }

        public static void Psummon(ZoneClient ClientSocket, String sID) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&psummon {0}", sID)); }

        public static void Linkto(ZoneClient ClientSocket, String MapIndex) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&linkto {0}", MapIndex)); }

        public static void Linkto(ZoneClient ClientSocket, String MapIndex, Int32 X, Int32 Y) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&linkto {0} {1} {2}", MapIndex, X, Y)); }

        public static void Levelup(ZoneClient ClientSocket, Byte Amount) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&levelup {0}", Amount)); }

        public static void LearnSkill(ZoneClient ClientSocket, Int32 SkillID) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&learnskill {0}", SkillID)); }

        public static void LearnPassive(ZoneClient ClientSocket, Int32 PassiveID) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&learnpassive {0}", PassiveID)); }

        public static void SetAbstate(ZoneClient ClientSocket, String AbstateIndex) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&setabstate {0}", AbstateIndex)); }

        public static void SetAbstate(ZoneClient ClientSocket, String AbstateIndex, Int32 AbstateTime) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&setabstate {0} {1}", AbstateIndex, AbstateTime)); }

        public static void SetAbstate(ZoneClient ClientSocket, String AbstateIndex, Int32 AbstateTime, Byte EffectLevel) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&setabstate {0} {1} {2}", AbstateIndex, AbstateTime, EffectLevel)); }

        public static void ExpBonus(ZoneClient ClientSocket, String MapIndex, Int32 NewDropRate) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&expbonus {0} {1}", MapIndex, NewDropRate)); }

        public static void ItemBonus(ZoneClient ClientSocket, String MapIndex, Int32 NewItemRate) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&itembonus {0} {1}", MapIndex, NewItemRate)); }

        public static void KQReward(ZoneClient ClientSocket, Int32 KQID) { GlobalPacket.SendNormalMessageClient(ClientSocket, String.Format("&kqreward {0}", KQID)); }

        public static void Distribute(ZoneClient ClientSocket) { GlobalPacket.SendNormalMessageClient(ClientSocket, "&distribute"); }
    }
}
