public static void LoadRates()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("gameupdates");
            PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd);
            if (r.Read())
            {
                Body1 = r.ReadString("Body1");
                Body2 = r.ReadString("Body2");
                Body3 = r.ReadString("Body3");
                Body4 = r.ReadString("Body4");
                Body5 = r.ReadString("Body5");
                Body6 = r.ReadString("Body6");
                Header = r.ReadString("Header");

            }
            Console.WriteLine("System GameUpdates  Loaded.");
            r.Close();
            r.Dispose();
        }
        public static void GetMembers()
        {
            foreach (KeyValuePair<uint, Game.Clans> G in PhoenixProject.ServerBase.Kernel.ServerClans)
            {
                Game.Clans clan = G.Value;
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
                cmd.Select("entities").Where("ClanId", clan.ClanId);
                PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd);
                while (r.Read())
                {

                    Game.ClanMembers member = new PhoenixProject.Game.ClanMembers();
                    member.Donation = r.ReadUInt32("ClanDonation");
                    //member.Rank = r.ReadByte("ClanRank");
                    member.UID = r.ReadUInt32("UID");
                    member.Name = r.ReadString("Name");
                    member.Class = r.ReadUInt16("Class");
                    member.Level = r.ReadByte("Level");

                    if (clan.ClanLider == member.Name)
                    {
                        member.Rank = 100;
                    }
                    else
                    {
                        member.Rank = 10;
                    }

                    if (!clan.Members.ContainsKey(member.UID))
                        clan.Members.Add(member.UID, member);
                }
                r.Close();
                //r.Close();
                r.Dispose();
                //Console.WriteLine("1818");
            }
        }
        public static void LoadRates()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("helpdesk");
            PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd);
            if (r.Read())
            {
                Register = r.ReadString("Register");
                Vote = r.ReadString("Vote");
                ChatBox = r.ReadString("ChatBox");
                Purchase = r.ReadString("Purchase");
                Facebook = r.ReadString("Facebook");
                ChangePass = r.ReadString("ChangePass");

            }
            Console.WriteLine("HelpDesk Table Loaded.");
            r.Close();
            r.Dispose();
        }
        public static void LoadAllClans()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("Clans");
            PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd);
            while (r.Read())
            {
                Game.Clans clan = new PhoenixProject.Game.Clans();
                clan.ClanLider = r.ReadString("Leader");
                clan.ClanId = r.ReadUInt32("ClanID");
                clan.ClanName = r.ReadString("Name");
                clan.ClanBuletion = r.ReadString("Bulletin");
                clan.ClanDonation = r.ReadUInt32("Fund");
                clan.ClanLevel = r.ReadByte("Level");
                if (!PhoenixProject.ServerBase.Kernel.ServerClans.ContainsKey(clan.ClanId))
                    PhoenixProject.ServerBase.Kernel.ServerClans.Add(clan.ClanId, clan);
            }
            r.Close();
            //r.Close();
            r.Dispose();

            Console.WriteLine("Clans Loading " + PhoenixProject.ServerBase.Kernel.ServerClans.Count);
            GetMembers();
               // Console.WriteLine("1515");
            foreach (Game.Clans c in ServerBase.Kernel.ServerClans.Values)
            {
                c.LoadAssociates();
            }
        }
        public static void LoadRates()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("rates").Where("Coder", "Kimo");
            PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd);
            if (r.Read())
            {
                lastentity = r.ReadUInt32("LastEntity");
                //Program.EntityUID = new ServerBase.Counter(r.ReadUInt32("LastEntity"));
                lastitem = r.ReadUInt32("LastItem");
                KoCount = r.ReadUInt32("KoCount");
                plus13 = r.ReadUInt32("Plus13");
                plus14 = r.ReadUInt32("Plus14");
                plus15 = r.ReadUInt32("Plus15");
                PartyDrop = r.ReadUInt32("PartyDrop");
                CaptureFlag = r.ReadUInt32("CaptureFlag");
                SkillTeam = r.ReadUInt32("SkillTeam");
                DemonCave = r.ReadUInt32("DemonCave");
                VoteUrl = r.ReadString("VoteUrl");
                VotePrize = r.ReadUInt32("VotePrize");
                Weather = r.ReadUInt32("Weather");
                Night = r.ReadUInt32("Night");
                SoulP6 = r.ReadUInt32("SoulP6");
                Garment = r.ReadUInt32("Garment");
                Steed = r.ReadUInt32("Steed");
                Mount = r.ReadUInt32("Mount");
                DamageTails = r.ReadUInt32("DamageTails");
                DamageGarment = r.ReadUInt32("DamageGarment");
                LevelUp = r.ReadUInt32("LevelUp");
                TeratoDragon = r.ReadUInt32("TeratoDragon");
                ThrillingSpook = r.ReadUInt32("ThrillingSpook");
                SnowBanshe = r.ReadUInt32("SnowBanshe");
                TreasureLow = r.ReadUInt32("TreasureLow");
                TreasureMax = r.ReadUInt32("TreasureMax");
                TreasureMin = r.ReadUInt32("TreasureMin");
                GuildWar = r.ReadUInt32("GuildWar");
                BotJail = r.ReadUInt32("BotJail");
                RemoveBound = r.ReadUInt32("RemoveBound");
                elitepk = r.ReadUInt32("elitepk");
                SteedRace = r.ReadUInt32("SteedRace");
                ChangeName = r.ReadUInt32("ChangeName");
                MonthlyPk = r.ReadUInt32("MonthlyPk");
                EliteGw = r.ReadUInt32("EliteGw");
                TopSpouse = r.ReadUInt32("TopSpouse");
                DailyPk = r.ReadUInt32("DailyPk");
                LastMan = r.ReadUInt32("LastMan");
                Riencration = r.ReadUInt32("Riencration");
                king = r.ReadUInt32("kings");
                prince = r.ReadUInt32("prince");
                housepromete = r.ReadUInt32("HousePromete");
                houseupgrade = r.ReadUInt32("HouseUpgrade");
                itembox = r.ReadUInt32("ItemBox");
                maxcps = r.ReadUInt32("MaxCps");
                minicps = r.ReadUInt32("MiniCps");
                CpsMethodNum = r.ReadUInt32("CpsMethodNum");
                classpk = r.ReadUInt32("ClassPk");
                weeklypk = r.ReadUInt32("WeeklyPk");

                cpsmethod = r.ReadString("CpsMethod");
                serversite = r.ReadString("ServerWebsite");
                servername = r.ReadString("ServerName");
                coder = r.ReadString("Coder");
                PopUpURL = r.ReadString("LoginSite");
                ServerBase.Constants.ServerName2 = r.ReadString("ServerName");
                ServerBase.Constants.GameCryptographyKey = r.ReadString("CryptKey");
            }
            Console.WriteLine("Rates Loaded.");
            r.Close();
            r.Dispose();
        }
        public static void Load()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("specialdrops");
            PhoenixProject.Database.MySqlReader rdr = new PhoenixProject.Database.MySqlReader(cmd);
            while (rdr.Read())
            {
                SpecialItemDrop sitem = new SpecialItemDrop();
                sitem.ItemID = rdr.ReadInt32("itemid");
                sitem.Rate = rdr.ReadInt32("rate");
                sitem.Discriminant = rdr.ReadInt32("discriminant");
                sitem.Map = rdr.ReadUInt64("map");
                SpecialItemDropList.Add(sitem);
            }
            rdr.Close();
            rdr.Dispose();
            MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
            command.Select("monsterinfos");
            PhoenixProject.Database.MySqlReader reader = new PhoenixProject.Database.MySqlReader(command);
            while (reader.Read())
            {
                MonsterInformation mf = new MonsterInformation();
                mf.ID = reader.ReadUInt32("id");
                mf.Name = reader.ReadString("name");
                mf.Mesh = reader.ReadUInt16("lookface");
                mf.Level = reader.ReadByte("level");
                mf.Hitpoints = reader.ReadUInt32("life");
                ServerBase.IniFile IniFile = new ServerBase.IniFile(ServerBase.Constants.MonstersPath);
                if (IniFile.ReadString(mf.Name, "MaxLife") != "")
                {
                    if (uint.Parse(IniFile.ReadString(mf.Name, "MaxLife")) != 0)
                    {
                        mf.Hitpoints = uint.Parse(IniFile.ReadString(mf.Name, "MaxLife"));
                        byte boss = byte.Parse(IniFile.ReadString(mf.Name, "Boss"));
                        if (boss == 0)
                            mf.Boss = false;
                        else mf.Boss = true;
                    }
                }
                mf.ViewRange = reader.ReadUInt16("view_range");
                mf.AttackRange = reader.ReadUInt16("attack_range");
                mf.AttackType = reader.ReadByte("attack_user");
                mf.MinAttack = reader.ReadUInt32("attack_min");
                mf.MaxAttack = reader.ReadUInt32("attack_max");
                mf.SpellID = reader.ReadUInt16("magic_type");
                mf.MoveSpeed = reader.ReadInt32("move_speed");
                mf.RunSpeed = reader.ReadInt32("run_speed");
                mf.OwnItemID = reader.ReadInt32("ownitem");
                mf.HPPotionID = reader.ReadInt32("drop_hp");
                mf.MPPotionID = reader.ReadInt32("drop_mp");
                mf.OwnItemRate = reader.ReadInt32("ownitemrate");
                mf.AttackSpeed = reader.ReadInt32("attack_speed");
                mf.ExtraExperience = reader.ReadUInt32("extra_exp");
                uint MoneyDropAmount = reader.ReadUInt16("level");
                if (MoneyDropAmount != 0)
                {
                    mf.MaxMoneyDropAmount = MoneyDropAmount * 25;
                    if (mf.MaxMoneyDropAmount != 0)
                        mf.MinMoneyDropAmount = 1;
                }
                if (mf.MoveSpeed <= 500)
                    mf.MoveSpeed += 500;
                if (mf.AttackSpeed <= 500)
                    mf.AttackSpeed += 500;
                MonsterInfos.Add(mf.ID, mf);
                byte lvl = mf.Level;
                if (mf.Name == "Slinger" ||
                    mf.Name == "GoldGhost" ||
                    mf.Name == "AgileRat" ||
                    mf.Name == "Bladeling" ||
                    mf.Name == "BlueBird" ||
                    mf.Name == "BlueFiend" ||
                    mf.Name == "MinotaurL120")
                {
                    mf.LabirinthDrop = true;
                    lvl = 20;
                }
                if (!ItemDropCache.ContainsKey(lvl))
                {
                    List<uint> itemdroplist = new List<uint>();
                    foreach (ConquerItemBaseInformation itemInfo in ConquerItemInformation.BaseInformations.Values)
                    {

                        if (itemInfo.ID >= 800000 && itemInfo.ID <= 824014)
                            continue;
                        ushort position = Network.PacketHandler.ItemPosition(itemInfo.ID);
                        if (Network.PacketHandler.IsArrow(itemInfo.ID) || itemInfo.Level == 0 || itemInfo.Level > 121)
                            continue;
                        if (position < 9 && position != 7)
                        {
                            if (itemInfo.Level == 100)
                                if (itemInfo.Name.Contains("Dress"))
                                    continue;
                            if (itemInfo.Level > 121)
                                continue;
                            int diff = (int)lvl - (int)itemInfo.Level;
                            if (!(diff > 10 || diff < -10))
                            {
                                itemdroplist.Add(itemInfo.ID);
                            }
                        }
                        if (position == 10 || position == 11 && lvl >= 70)
                            itemdroplist.Add(itemInfo.ID);
                    }
                    ItemDropCache.Add(lvl, itemdroplist);
                }
                if (mf.Boss)
                {
                    List<uint> itemdroplist = new List<uint>();
                    foreach (ConquerItemBaseInformation itemInfo in ConquerItemInformation.BaseInformations.Values)
                    {
                        if (itemInfo.ID >= 800000 && itemInfo.ID <= 824014)
                        {
                            if (itemInfo.PurificationLevel <= 3)
                            {
                                int diff = (int)mf.Level - (int)itemInfo.Level;
                                if (!(diff > 10 || diff < -10))
                                {
                                    itemdroplist.Add(itemInfo.ID);
                                }
                            }
                        }
                    }
                    SoulItemCache.Add(lvl, itemdroplist);
                }
            }

            reader.Close();
            reader.Dispose();
            Console.WriteLine("Monster information loaded.");
            Console.WriteLine("Monster drops generated.");
        }
        public static void LoadRates()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("systemmessage");
            PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd);
            if (r.Read())
            {
                EliteGW2 = r.ReadString("EliteGW2");
                ClassPk = r.ReadString("ClassPk");
                GuildFlame = r.ReadString("GuildFlame");
                DisEnd = r.ReadString("DisEnd");
                DailyPk = r.ReadString("DailyPk");
                CouplesPk = r.ReadString("CouplesPk");
                SteedRace = r.ReadString("SteedRace");

                Sys = r.ReadString("Sys");
                Sys2 = r.ReadString("Sys2");
                Sys3 = r.ReadString("Sys3");
                Sys4 = r.ReadString("Sys4");
                Sys5 = r.ReadString("Sys5");
                Sys6 = r.ReadString("Sys6");
                Sys7 = r.ReadString("Sys7");
                Sys8 = r.ReadString("Sys8");
                Sys9 = r.ReadString("Sys9");

            }
            Console.WriteLine("System Messages  Loaded.");
            r.Close();
            r.Dispose();
        }
        public static void UpdateNames()
        {
            Dictionary<String, NameChangeC> UPDATE = new Dictionary<string, NameChangeC>();
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("entities");
            PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd);
            String newname = "", name = "";
            int UID;
            while (r.Read())
            {
                newname = r.ReadString("namechange");
                name = r.ReadString("name");
                UID = (int)r.ReadInt64("UID");
                if (newname != "")
                {
                    MySqlCommand cmdupdate = null;
                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("apprentice").Set("MentorName", newname).Where("MentorID", UID).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("apprentice").Set("ApprenticeName", newname).Where("ApprenticeID", UID).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("elitepk").Set("Name", newname).Where("UID", UID).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopArcher", newname).Where("TopArcher", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopPirate", newname).Where("TopPirate", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopTrojan", newname).Where("TopTrojan", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopGuildLeader", newname).Where("TopGuildLeader", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopNinja", newname).Where("TopNinja", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopMonk", newname).Where("TopMonk", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopWarrior", newname).Where("TopWarrior", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopSpouse", newname).Where("TopSpouse", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopWaterTaoist", newname).Where("TopWaterTaoist", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopFireTaoist", newname).Where("TopFireTaoist", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("MonthlyPkChampion", newname).Where("MonthlyPkChampion", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("WeeklyPkChampion", newname).Where("WeeklyPkChampion", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopDeputyLeader", newname).Where("TopDeputyLeader", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopDeputyLeader2", newname).Where("TopDeputyLeader2", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopDeputyLeader3", newname).Where("TopDeputyLeader3", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopDeputyLeader4", newname).Where("TopDeputyLeader4", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("flags").Set("TopDeputyLeader5", newname).Where("TopDeputyLeader5", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("arena").Set("EntityName", newname).Where("EntityID", UID).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("claimitems").Set("OwnerName", newname).Where("OwnerName", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("claimitems").Set("GainerName", newname).Where("GainerName", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("detaineditems").Set("OwnerName", newname).Where("OwnerName", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("detaineditems").Set("GainerName", newname).Where("GainerName", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("enemy").Set("EnemyName", newname).Where("EnemyID", UID).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("friends").Set("FriendName", newname).Where("FriendID", UID).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("guilds").Set("Name", newname).Where("Name", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("guilds").Set("LeaderName", newname).Where("LeaderName", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("clans").Set("Leader", newname).Where("Leader", name).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("nobility").Set("EntityName", newname).Where("EntityUID", UID).Execute();

                    cmdupdate = new MySqlCommand(MySqlCommandType.UPDATE);
                    cmdupdate.Update("partners").Set("PartnerName", newname).Where("PartnerID", UID).Execute();

                    if (!UPDATE.ContainsKey(name))
                        UPDATE.Add(name, new NameChangeC() { NewName = newname, OldName = name });
                }
            }
            r.Close();
            r.Dispose();
            if (UPDATE.Count > 0)
            {
                Console.ForegroundColor = ConsoleColor.DarkGreen;
                Console.WriteLine(" [NAME CHANGES]");
            }
            foreach (NameChangeC names in UPDATE.Values)
            {
                MySqlCommand cmdupdate2 = new MySqlCommand(MySqlCommandType.UPDATE);
                cmdupdate2.Update("entities").Set("Name", names.NewName).Set("namechange", "").Where("Name", names.OldName).Execute();

                Console.WriteLine(" -[" + names.OldName + "] : -[" + names.NewName + "]");
                Console.ForegroundColor = ConsoleColor.White;
            }
            foreach (NameChangeC names in UPDATE.Values)
            {
                MySqlCommand cmdupdate2 = new MySqlCommand(MySqlCommandType.UPDATE);
                cmdupdate2.Update("entities").Set("Spouse", names.NewName).Where("Spouse", names.OldName).Execute();
            }
            UPDATE.Clear();
        }
 private void LoadNpcs()
 {
     Database.MySqlCommand command = new PhoenixProject.Database.MySqlCommand(PhoenixProject.Database.MySqlCommandType.SELECT);
     command.Select("npcs").Where("mapid", ID);
     PhoenixProject.Database.MySqlReader reader = new PhoenixProject.Database.MySqlReader(command);
     while (reader.Read())
     {
         INpc npc = new Network.GamePackets.NpcSpawn();
         npc.UID = reader.ReadUInt32("id");
         npc.Mesh = reader.ReadUInt16("lookface");
         npc.Type = (Enums.NpcType)reader.ReadByte("type");
         npc.X = reader.ReadUInt16("cellx"); ;
         npc.Y = reader.ReadUInt16("celly");
         npc.MapID = ID;
         //Network.GamePackets.PokerTable npc2 = new Network.GamePackets.PokerTable();
         AddNpc(npc);
     }
     reader.Close();
     reader.Dispose();
     command = new PhoenixProject.Database.MySqlCommand(PhoenixProject.Database.MySqlCommandType.SELECT);
     command.Select("sobnpcs").Where("mapid", ID);
     reader = new PhoenixProject.Database.MySqlReader(command);
     while (reader.Read())
     {
         Network.GamePackets.SobNpcSpawn npc = new Network.GamePackets.SobNpcSpawn();
         npc.UID = reader.ReadUInt32("id");
         npc.Mesh = reader.ReadUInt16("lookface");
         if (ID == 1039)
             npc.Mesh = (ushort)(npc.Mesh - npc.Mesh % 10 + 7);
         npc.Type = (Enums.NpcType)reader.ReadByte("type");
         npc.X = reader.ReadUInt16("cellx"); ;
         npc.Y = reader.ReadUInt16("celly");
         npc.MapID = reader.ReadUInt16("mapid");
         npc.Sort = reader.ReadUInt16("sort");
         npc.ShowName = true;
         npc.Name = reader.ReadString("name");
         npc.Hitpoints = reader.ReadUInt32("life");
         npc.MaxHitpoints = reader.ReadUInt32("maxlife");
         AddNpc(npc);
     }
     reader.Close();
     reader.Dispose();
 }
        public FlowerRank(uint UID)
        {
            int PacketLength = 80;
            uint charamount = 0;
            uint place = 1;
            string[] playernames = new string[100000];
            uint[] playerflowers = new uint[1000000];
            MemoryStream Stream = new MemoryStream();
            BinaryWriter Writer = new BinaryWriter(Stream);
            Database.MySqlCommand cmd = new Database.MySqlCommand(Database.MySqlCommandType.SELECT);
            cmd.Select("flowers").Order("redroses DESC");
            PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd);
            while (r.Read())
            {
                int redroses = r.ReadInt32("redroses");
                if (redroses != 0)
                {
                    uint charuid = r.ReadUInt32("id");
                    PacketLength += (r.ReadString("name").Length * 2) + 36;
                    playernames[charamount] = r.ReadString("name");
                    playerflowers[charamount] = r.ReadUInt32("redroses");
                    charamount++;

                }
            }
            Buffer = new byte[80 +8];
            WriteUInt16(80, 0, Buffer);
            WriteUInt16(1151, 2, Buffer);

            WriteUInt32(1, 4, Buffer);
            WriteUInt32(UID, 8, Buffer);
            WriteUInt32(0, 12, Buffer);
            WriteUInt32(charamount, 16, Buffer);
            int position = 24;
            for(int x = 0; x < charamount; x++)
            {
               // WriteUInt32(1, position, Buffer);
               // position+=4;
                WriteUInt32(place, position, Buffer);
                place++;
                //WriteUInt32(place, position, Buffer);
                position+=4;
                WriteUInt32(playerflowers[1], position, Buffer);
                position += 4;
                WriteUInt32(playerflowers[1], position, Buffer);
                position += 4;
                WriteUInt32(UID, position, Buffer);
                position += 4;
                WriteUInt32(UID, position, Buffer);
                position += 4;
                WriteString(playernames[x], position, Buffer);
                position += 16;
                WriteUInt32(1, position, Buffer);
                position += 4;
                WriteString(playernames[x], position, Buffer);
                position += 8;
                position = position + 16;

            }

            WriteString("TQServer", position, Buffer);
        }
        public static void LoadPlayersVots()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("VoteIp");
            PhoenixProject.Database.MySqlReader d = new PhoenixProject.Database.MySqlReader(cmd);
            while (d.Read())
            {
                PhoenixProject.Game.ConquerStructures.PlayersVot Vot = new PhoenixProject.Game.ConquerStructures.PlayersVot();
                Vot.Uid = d.ReadUInt32("ID");
                Vot.AdressIp = d.ReadString("IP");
                if (!Kernel.VotePool.ContainsKey(Vot.AdressIp))
                    Kernel.VotePool.Add(Vot.AdressIp, Vot);
                if (!Kernel.VotePoolUid.ContainsKey(Vot.Uid))
                    Kernel.VotePoolUid.Add(Vot.Uid, Vot);

            }
            d.Close();
            d.Dispose();
        }