示例#1
0
        public static void GetMembers()
        {
            foreach (KeyValuePair<uint, Game.Clans> G in Conquer_Online_Server.ServerBase.Kernel.ServerClans)
            {
                Game.Clans clan = G.Value;
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
                cmd.Select("entities").Where("ClanID", clan.ClanId);
                MySqlReader r = new MySqlReader(cmd);
                while (r.Read())
                {

                    Game.ClanMembers member = new Conquer_Online_Server.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.Members.ContainsKey(member.UID))
                        clan.Members.Add(member.UID, member);
                }
                r.Close();
            }
        }
示例#2
0
 public static void Load()
 {
     MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
     command.Select("maps");
     MySqlReader reader = new MySqlReader(command);
     while (reader.Read())
     {
         MapInformation info = new MapInformation();
         info.ID = reader.ReadUInt16("id");
         info.BaseID = reader.ReadUInt16("mapdoc");
         info.Status = reader.ReadUInt32("type");
         info.Weather = reader.ReadUInt32("weather");
         MapInformations.Add(info.ID, info);
     }
     reader.Close();
     Console.WriteLine("Map informations loaded.");
 }
示例#3
0
 public static Interfaces.IConquerItem GetSingleItem(uint UID)
 {
     Interfaces.IConquerItem item = new Network.GamePackets.ConquerItem(true);
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("items").Where("UID", UID);
     MySqlReader r = new MySqlReader(cmd);
     if (r.Read())
     {
         item.ID = r.ReadUInt32("ID");
         item.UID = r.ReadUInt32("UID");
         item.Durability = r.ReadUInt16("Durability");
         item.MaximDurability = r.ReadUInt16("MaximDurability");
         item.Position = r.ReadUInt16("Position");
         item.SocketProgress = r.ReadUInt32("SocketProgress");
         item.PlusProgress = r.ReadUInt32("PlusProgress");
         item.SocketOne = (Game.Enums.Gem)r.ReadByte("SocketOne");
         item.SocketTwo = (Game.Enums.Gem)r.ReadByte("SocketTwo");
         item.Effect = (Game.Enums.ItemEffect)r.ReadByte("Effect");
         item.Mode = Game.Enums.ItemMode.Default;
         item.Plus = r.ReadByte("Plus");
         item.Bless = r.ReadByte("Bless");
         item.Bound = r.ReadBoolean("Bound");
         item.Enchant = r.ReadByte("Enchant");
         item.Lock = r.ReadByte("Locked");
         item.UnlockEnd = DateTime.FromBinary(r.ReadInt64("UnlockEnd"));
         item.Suspicious = r.ReadBoolean("Suspicious");
         item.RefineryPart = r.ReadUInt32("RefineryPart");
         item.RefineryLevel = r.ReadUInt32("RefineryLevel");
         item.RefineryPercent = r.ReadUInt16("RefineryPercent");
         item.RefineryStarted = DateTime.FromBinary(r.ReadInt64("RefineryStarted"));
         item.SuspiciousStart = DateTime.FromBinary(r.ReadInt64("SuspiciousStart"));
         item.Color = (Game.Enums.Color)r.ReadByte("Color");
         item.Warehouse = r.ReadUInt16("Warehouse");
         if (item.Lock == 2)
             if (DateTime.Now >= item.UnlockEnd)
                 item.Lock = 0;
     }
     r.Close();
     return item;
 }
示例#4
0
 public static void LoadSpells(Client.GameState client)
 {
     if (client.Entity == null)
         return;
     client.Spells = new System.SafeDictionary<ushort, Interfaces.ISkill>(100);
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("skills").Where("Type", "Spell").And("EntityID", client.Entity.UID);
     MySqlReader r = new MySqlReader(cmd);
     while (r.Read())
     {
         Interfaces.ISkill spell = new Network.GamePackets.Spell(true);
         spell.ID = r.ReadUInt16("ID");
         spell.Level = r.ReadByte("Level");
         spell.PreviousLevel = r.ReadByte("PreviousLevel");
         spell.Experience = r.ReadUInt32("Experience");
         spell.Available = true;
         if (!client.Spells.ContainsKey(spell.ID))
             client.Spells.Add(spell.ID, spell);
     }
     r.Close();
 }
示例#5
0
        public static void Load()
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("specialdrops");
            MySqlReader rdr = new 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.ReadInt32("map");
                SpecialItemDropList.Add(sitem);
            }
            rdr.Close();
            MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
            command.Select("monsterinfos");
            MySqlReader reader = new 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;
                        if (mf.Name == "TeratoDragon" || mf.Name == "SnowBanshee")
                        {
                            mf.SuperBoss = 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");
                #region TeratoDragon
                if (mf.Name == "TeratoDragon")
                {
                    byte times = (byte)ServerBase.Kernel.Random.Next(1, 4);
                    byte ref_times = (byte)ServerBase.Kernel.Random.Next(1, 6);
                    for (byte i = 0; i < times; i++)
                    {
                        uint Uid = 0;//
                        uint type = (byte)ServerBase.Kernel.Random.Next(1, 4);
                        switch (type)
                        {
                            case 1: Uid = 7013; break;
                            case 2: Uid = 7014; break;
                            case 3: Uid = 7017; break;
                            case 4: Uid = 10361; break;
                        }
                        if (Uid != 0)
                        {
                            mf.SpellID = (ushort)Uid;
                        }
                    }
                }
                #endregion
                #region Banshee
                if (mf.Name == "SnowBanshee")
                {
                    byte times = (byte)ServerBase.Kernel.Random.Next(1, 3);
                    byte ref_times = (byte)ServerBase.Kernel.Random.Next(1, 6);
                    for (byte i = 0; i < times; i++)
                    {
                        uint Uid = 0;//
                        uint type = (byte)ServerBase.Kernel.Random.Next(1, 3);
                        switch (type)
                        {
                            case 1: Uid = 30010; break;
                            case 2: Uid = 30011; break;
                            case 3: Uid = 30012; break;
                        }

                        if (Uid != 0)
                        {
                            mf.SpellID = (ushort)Uid;
                        }
                    }
                }
                #endregion
                #region ThrillingSpook
                if (mf.Name == "ThrillingSpook")
                {
                    byte times = (byte)ServerBase.Kernel.Random.Next(1, 4);
                    byte ref_times = (byte)ServerBase.Kernel.Random.Next(1, 6);
                    for (byte i = 0; i < times; i++)
                    {
                        uint Uid = 0;//
                        uint type = (byte)ServerBase.Kernel.Random.Next(1, 4);
                        switch (type)
                        {
                            case 1: Uid = 10363; break;
                            case 2: Uid = 10362; break;
                            case 3: Uid = 10360; break;
                            case 4: Uid = 10361; break;
                        }
                        if (Uid != 0)
                        {
                            mf.SpellID = (ushort)Uid;
                        }
                    }
                }
                #endregion
                #region SwordMaster
                if (mf.Name == "SwordMaster")
                {
                    byte times = (byte)ServerBase.Kernel.Random.Next(1, 4);
                    byte ref_times = (byte)ServerBase.Kernel.Random.Next(1, 6);
                    for (byte i = 0; i < times; i++)
                    {
                        uint Uid = 0;//
                        uint type = (byte)ServerBase.Kernel.Random.Next(1, 4);
                        switch (type)
                        {
                            case 1: Uid = 10504; break;
                            case 2: Uid = 10506; break;
                            case 3: Uid = 10502; break;
                            case 4: Uid = 10505; break;
                        }
                        if (Uid != 0)
                        {
                            mf.SpellID = (ushort)Uid;
                        }
                    }
                }
                #endregion
                //
                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 || (mf.SuperBoss && itemInfo.PurificationLevel > 3))
                            {
                                int diff = (int)mf.Level - (int)itemInfo.Level;
                                if (!(diff > 20 || diff < -20))
                                {
                                    if (itemInfo.Level <= 110)
                                        itemdroplist.Add(itemInfo.ID);
                                }
                            }
                        }
                    }

                    SoulItemCache.Add(lvl, itemdroplist);
                }
            }

            //723755, 723768, 723772  ,723774
            reader.Close();
            Console.WriteLine("Monster information loaded.");
            Console.WriteLine("Monster drops generated.");
        }
示例#6
0
        public static void LoadItems(Client.GameState client)
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("items").Where("EntityID", client.Entity.UID);
            MySqlReader r = new MySqlReader(cmd);
            while (r.Read())
            {
                Interfaces.IConquerItem item = new Network.GamePackets.ConquerItem(true);
                item.ID = r.ReadUInt32("ID");
                item.UID = r.ReadUInt32("UID");
                item.Durability = r.ReadUInt16("Durability");
                item.MaximDurability = r.ReadUInt16("MaximDurability");

                item.Durability = item.MaximDurability;
                item.Position = r.ReadUInt16("Position");
                item.SocketProgress = r.ReadUInt32("SocketProgress");
                item.PlusProgress = r.ReadUInt32("PlusProgress");
                item.SocketOne = (Game.Enums.Gem)r.ReadByte("SocketOne");
                item.SocketTwo = (Game.Enums.Gem)r.ReadByte("SocketTwo");
                item.Effect = (Game.Enums.ItemEffect)r.ReadByte("Effect");
                item.Mode = Game.Enums.ItemMode.Default;
                item.Plus = r.ReadByte("Plus");
                item.Bless = r.ReadByte("Bless");
                item.Bound = r.ReadBoolean("Bound");
                item.Enchant = r.ReadByte("Enchant");
                item.Lock = r.ReadByte("Locked");
                item.UnlockEnd = DateTime.FromBinary(r.ReadInt64("UnlockEnd"));
                item.Suspicious = r.ReadBoolean("Suspicious");
                item.RefineryPart = r.ReadUInt32("RefineryPart");
                item.RefineryLevel = r.ReadUInt32("RefineryLevel");
                item.RefineryPercent = r.ReadUInt16("RefineryPercent");
                item.RefineryStarted = DateTime.FromBinary(r.ReadInt64("RefineryStarted"));
                item.SuspiciousStart = DateTime.FromBinary(r.ReadInt64("SuspiciousStart"));
                item.Color = (Game.Enums.Color)r.ReadByte("Color");
                item.Warehouse = r.ReadUInt16("Warehouse");
                item.Inscribed = (r.ReadByte("Inscribed") == 1 ? true : false);
                item.StackSize = r.ReadUInt16("StackSize");
                item.MaxStackSize = r.ReadUInt16("MaxStackSize");
                if (item.Lock == 2)
                    if (DateTime.Now >= item.UnlockEnd)
                        item.Lock = 0;
                ItemAddingTable.GetAddingsForItem(item);
                if (item.Warehouse == 0)
                {
                    switch (item.Position)
                    {
                        case 0: client.Inventory.Add(item, Game.Enums.ItemUse.None); break;
                        case 1:
                        case 2:
                        case 3:
                        case 4:
                        case 5:
                        case 6:
                        case 7:
                        case 8:
                        case 9:
                        case 10:
                        case 11:
                        case 12:
                        case 15:
                        case 16:
                        case 17:
                        case 18:
                            if (client.Equipment.Free((byte)item.Position))
                            {

                                client.Equipment.Add(item, Game.Enums.ItemUse.None);
                            }
                            else
                            {

                                if (client.Inventory.Count < 40)
                                {
                                    item.Position = 0;
                                    client.Inventory.Add(item, Game.Enums.ItemUse.None);
                                    if (client.Warehouses[Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity].Count < 60)
                                        client.Warehouses[Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID.StoneCity].Add(item);
                                    UpdatePosition(item, client);
                                }
                            }
                            break;
                    }
                }
                else
                {
                    client.Warehouses[(Conquer_Online_Server.Game.ConquerStructures.Warehouse.WarehouseID)item.Warehouse].Add(item);
                }

                if (item.ID == 720828)
                {
                    string agate = r.ReadString("agate");
                    uint count = 0;
                    string[] maps = agate.Split('#');
                    foreach (string one in maps)
                    {
                        if (one.Length > 6)
                        {
                            item.Agate_map.Add(count, one);
                            count++;
                        }
                    }
                }
            }
            r.Close();
        }
示例#7
0
        public static void Load()
        {
            MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
            command.Select("guilds");
            MySqlReader reader = new MySqlReader(command);
            while (reader.Read())
            {
                Guild guild = new Guild(reader.ReadString("LeaderName"));
                guild.ID = reader.ReadUInt16("ID");
                guild.Name = reader.ReadString("Name");
                guild.Wins = reader.ReadUInt32("Wins");
                guild.Losts = reader.ReadUInt32("Losts");
                guild.Bulletin = reader.ReadString("Bulletin");
                guild.SilverFund = reader.ReadUInt64("SilverFund");
                guild.ConquerPointFund = reader.ReadUInt32("ConquerPointFund");
                MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
                cmd.Select("entities").Where("GuildID", guild.ID);
                MySqlReader rdr = new MySqlReader(cmd);
                while (rdr.Read())
                {
                    Guild.Member member = new Guild.Member(guild.ID);
                    member.ID = rdr.ReadUInt32("UID");
                    member.Name = rdr.ReadString("Name");
                    member.Level = rdr.ReadByte("Level");

                    if (Game.ConquerStructures.Nobility.Board.ContainsKey(member.ID))
                    {
                        member.NobilityRank = Game.ConquerStructures.Nobility.Board[member.ID].Rank;
                        member.Gender = Game.ConquerStructures.Nobility.Board[member.ID].Gender;
                    }

                    member.Rank = (Conquer_Online_Server.Game.Enums.GuildMemberRank)rdr.ReadUInt16("GuildRank");
                    if (member.Rank == Conquer_Online_Server.Game.Enums.GuildMemberRank.GuildLeader)
                        guild.Leader = member;
                    else if (member.Rank == Conquer_Online_Server.Game.Enums.GuildMemberRank.DeputyLeader)
                        guild.DeputyLeaderCount++;
                    member.SilverDonation = rdr.ReadUInt64("GuildSilverDonation");
                    member.ConquerPointDonation = rdr.ReadUInt64("GuildConquerPointDonation");
                    guild.Members.Add(member.ID, member);
                }
                guild.MemberCount = (uint)guild.Members.Count;
                ServerBase.Kernel.Guilds.Add(guild.ID, guild);
                rdr.Close();
            }
            reader.Close();
            command = new MySqlCommand(MySqlCommandType.SELECT);
            command.Select("guildally");
            reader = new MySqlReader(command);
            while (reader.Read())
            {
                ushort guildID = reader.ReadUInt16("GuildID");
                ushort allyID = reader.ReadUInt16("AllyID");
                if (ServerBase.Kernel.Guilds.ContainsKey(allyID))
                {
                    if (Conquer_Online_Server.ServerBase.Kernel.Guilds.ContainsKey(guildID))
                        if (Conquer_Online_Server.ServerBase.Kernel.Guilds.ContainsKey(allyID))
                            ServerBase.Kernel.Guilds[guildID].Ally.Add(allyID, ServerBase.Kernel.Guilds[allyID]);
                }
            }
            reader.Close();
            command = new MySqlCommand(MySqlCommandType.SELECT);
            command.Select("guildenemy");
            reader = new MySqlReader(command);
            while (reader.Read())
            {
                ushort guildID = reader.ReadUInt16("GuildID");
                ushort enemyID = reader.ReadUInt16("EnemyID");
                if (ServerBase.Kernel.Guilds.ContainsKey(guildID))
                    if (ServerBase.Kernel.Guilds.ContainsKey(enemyID))
                    {
                        if (Conquer_Online_Server.ServerBase.Kernel.Guilds.ContainsKey(guildID))
                            if (Conquer_Online_Server.ServerBase.Kernel.Guilds.ContainsKey(enemyID))
                                ServerBase.Kernel.Guilds[guildID].Enemy.Add(enemyID, ServerBase.Kernel.Guilds[enemyID]);
                    }
            }
            reader.Close();
            Console.WriteLine("Guild information loaded.");
        }
示例#8
0
        public static void LoadKnownPersons(Client.GameState client)
        {
            client.Friends = new SafeDictionary<uint,Friend>(50);
            client.Enemy = new SafeDictionary<uint, Enemy>(10);
            client.Partners = new SafeDictionary<uint, TradePartner>(40);
            client.Apprentices = new SafeDictionary<uint, Apprentice>(10);

            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("friends").Where("EntityID", client.Entity.UID);
            MySqlReader reader = new MySqlReader(cmd);
            while(reader.Read())
            {
                Friend friend = new Friend();
                friend.ID = reader.ReadUInt32("FriendID");
                friend.Name = reader.ReadString("FriendName");
                friend.Message = reader.ReadString("Message");
                client.Friends.Add(friend.ID, friend);
            }
            reader.Close();

            cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("enemy").Where("EntityID", client.Entity.UID);
            reader = new MySqlReader(cmd);
            while (reader.Read())
            {
                Enemy enemy = new Enemy();
                enemy.ID = reader.ReadUInt32("EnemyID");
                enemy.Name = reader.ReadString("EnemyName");
                client.Enemy.Add(enemy.ID, enemy);
            }
            reader.Close();

            cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("partners").Where("EntityID", client.Entity.UID);
            reader = new MySqlReader(cmd);
            while (reader.Read())
            {
                TradePartner partner = new TradePartner();
                partner.ID = reader.ReadUInt32("PartnerID");
                partner.Name = reader.ReadString("PartnerName");
                partner.ProbationStartedOn = DateTime.FromBinary(reader.ReadInt64("ProbationStartedOn"));
                client.Partners.Add(partner.ID, partner);
            }
            reader.Close();

            cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("apprentice").Where("MentorID", client.Entity.UID);
            reader = new MySqlReader(cmd);
            while (reader.Read())
            {
                Apprentice app = new Apprentice();
                app.ID = reader.ReadUInt32("ApprenticeID");
                app.Name = reader.ReadString("ApprenticeName");
                app.EnroleDate = reader.ReadUInt32("EnroleDate");
                app.Actual_Experience = reader.ReadUInt64("Actual_Experience");
                app.Total_Experience = reader.ReadUInt64("Total_Experience");
                app.Actual_Plus = reader.ReadUInt16("Actual_Plus");
                app.Total_Plus = reader.ReadUInt16("Total_Plus");
                app.Actual_HeavenBlessing = reader.ReadUInt16("Actual_HeavenBlessing");
                app.Total_HeavenBlessing = reader.ReadUInt16("Total_HeavenBlessing");
                client.PrizeExperience += app.Actual_Experience;
                client.PrizePlusStone += app.Actual_Plus;
                client.PrizeHeavenBlessing += app.Actual_HeavenBlessing;
                client.Apprentices.Add(app.ID, app);

                if (client.PrizeExperience > 50 * 606)
                    client.PrizeExperience = 50 * 606;
            }
            reader.Close();

            cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("apprentice").Where("ApprenticeID", client.Entity.UID);
            reader = new MySqlReader(cmd);
            while (reader.Read())
            {
                client.Mentor = new Mentor();
                client.Mentor.ID = reader.ReadUInt32("MentorID");
                client.Mentor.Name = reader.ReadString("MentorName");
                client.Mentor.EnroleDate = reader.ReadUInt32("EnroleDate");
                client.AsApprentice = new Apprentice();
                client.AsApprentice.ID = client.Entity.UID;
                client.AsApprentice.Name = client.Entity.Name;
                client.AsApprentice.EnroleDate = client.Mentor.EnroleDate;
                client.AsApprentice.Actual_Experience = reader.ReadUInt64("Actual_Experience");
                client.AsApprentice.Total_Experience = reader.ReadUInt64("Total_Experience");
                client.AsApprentice.Actual_Plus = reader.ReadUInt16("Actual_Plus");
                client.AsApprentice.Total_Plus = reader.ReadUInt16("Total_Plus");
                client.AsApprentice.Actual_HeavenBlessing = reader.ReadUInt16("Actual_HeavenBlessing");
                client.AsApprentice.Total_HeavenBlessing = reader.ReadUInt16("Total_HeavenBlessing");
            }
            reader.Close();
        }
示例#9
0
 public void LoadTop8()
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("elitepk");
     MySqlReader r = new MySqlReader(cmd);
     while (r.Read())
     {
         Team_client client = new Team_client(
             r.ReadUInt32("UID")
             , r.ReadUInt16("Avatar")
             , r.ReadUInt16("Mesh")
             , r.ReadString("Name")
             , r.ReadUInt32("Points")
             , r.ReadUInt16("Postion")
             , r.ReadByte("MyTitle")
             );
         if (!Top8.ContainsKey(client.UID))
             Top8.Add(client.UID, client);
     }
     r.Close();
 }
示例#10
0
 public static bool LoadTop2(Client.GameState client)
 {
     MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
     cmd.Select("Top2").Where("UID", client.Account.EntityID);
     MySqlReader r = new MySqlReader(cmd);
     if (r.Read())
     {
         //client.Entity.UID = r.ReadUInt32("UID");
         client.Entity.TopMonk2 = r.ReadUInt16("TopMonk2");
         client.Entity.TopTrojan2 = r.ReadUInt16("TopTrojan2");
         client.Entity.TopWarrior2 = r.ReadUInt16("TopWarrior2");
         client.Entity.TopNinja2 = r.ReadUInt16("TopNinja2");
         client.Entity.TopWaterTaoist2 = r.ReadUInt16("TopWaterTaoist2");
         client.Entity.TopArcher2 = r.ReadUInt16("TopArcher2");
         client.Entity.TopFireTaoist2 = r.ReadUInt16("TopFireTaoist2");
     }
     else
         return false;
     return true;
 }
示例#11
0
        public static bool LoadEntity(Client.GameState client)
        {
            MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT);
            cmd.Select("entities").Where("UID", client.Account.EntityID);
            MySqlReader r = new MySqlReader(cmd);
            if (r.Read())
            {
                client.Entity = new Game.Entity(Game.EntityFlag.Player, false);
                client.Entity.Name = r.ReadString("Name");
                client.Entity.Spouse = r.ReadString("Spouse");
                client.Entity.Owner = client;
                client.WarehousePW = r.ReadString("WarehousePW");
                client.MoneySave = r.ReadUInt32("MoneySave");
                client.Entity.Experience = r.ReadUInt64("Experience");
                client.Entity.Money = r.ReadUInt32("Money");
                client.Entity.boundCPs = r.ReadUInt32("BoundCPs");
                client.Entity.ConquerPoints = (uint)r.ReadUInt32("ConquerPoints");
                client.Entity.UID = r.ReadUInt32("UID");
                client.Entity.Hitpoints = r.ReadUInt32("Hitpoints");
                client.Entity.QuizPoints = r.ReadUInt32("QuizPoints");
                client.Entity.Body = r.ReadUInt16("Body");
                client.Entity.Face = r.ReadUInt16("Face");
                client.Entity.Strength = r.ReadUInt16("Strength");
                client.Entity.Agility = r.ReadUInt16("Agility");
                client.Entity.Spirit = r.ReadUInt16("Spirit");
                client.Entity.Vitality = r.ReadUInt16("Vitality");
                client.Entity.Atributes = r.ReadUInt16("Atributes");
                client.VirtuePoints = r.ReadUInt32("VirtuePoints");
                client.Entity.Mana = r.ReadUInt16("Mana");
                client.Entity.HairStyle = r.ReadUInt16("HairStyle");
                client.Entity.MapID = r.ReadUInt16("MapID");
                client.VendingDisguise = r.ReadUInt16("VendingDisguise");
                if (client.VendingDisguise == 0)
                    client.VendingDisguise = 223;
                client.Entity.X = r.ReadUInt16("X");
                client.Entity.Y = r.ReadUInt16("Y");
                client.BlessTime = r.ReadUInt32("BlessTime");
                client.Entity.TopTrojan = r.ReadUInt16("TopTrojan");
                client.Entity.TopWarrior = r.ReadUInt16("TopWarrior");
                client.Entity.TopNinja = r.ReadUInt16("TopNinja");
                client.Entity.TopWaterTaoist = r.ReadUInt16("TopWaterTaoist");
                client.Entity.TopArcher = r.ReadUInt16("TopArcher");
                client.Entity.TopGuildLeader = r.ReadUInt16("TopGuildLeader");
                client.Entity.TopFireTaoist = r.ReadUInt16("TopFireTaoist");
                client.Entity.TopDeputyLeader = r.ReadUInt16("TopDeputyLeader");
                client.Entity.WeeklyPKChampion = r.ReadUInt16("WeeklyPKChampion");
                client.Entity.TopMonk = r.ReadUInt16("TopMonk");
                client.Entity.TopGuildLeader = r.ReadUInt16("TopGuildLeader");

                client.Entity.QQ1 = r.ReadUInt16("QQ1");
                client.Entity.QQ2 = r.ReadUInt16("QQ2");
                client.Entity.QQ3 = r.ReadUInt16("QQ3");
                client.LotteryEntries2 = r.ReadByte("LotteryEntries2");//not fond
                //client.Entity.TitlePacket = new Network.GamePackets.TitlePacket(true);
                //client.Entity.TitlePacket.UID = client.Entity.UID;
                //client.Entity.TitlePacket.Type = 4;
                //client.Entity.TitlePacket.dwParam = 1;
                //client.Entity.TitlePacket.dwParam2 = r.ReadByte("My_Title");
                client.ChatBanTime = DateTime.FromBinary(r.ReadInt64("ChatBanTime"));
                client.ChatBanLasts = r.ReadUInt32("ChatBanLasts");
                client.ChatBanned = r.ReadBoolean("ChatBanned");
                client.HeadgearClaim = r.ReadBoolean("HeadgearClaim");
                client.NecklaceClaim = r.ReadBoolean("NecklaceClaim");
                client.ArmorClaim = r.ReadBoolean("ArmorClaim");
                client.WeaponClaim = r.ReadBoolean("WeaponClaim");
                client.RingClaim = r.ReadBoolean("RingClaim");
                client.BootsClaim = r.ReadBoolean("BootsClaim");
                client.FanClaim = r.ReadBoolean("FanClaim");
                client.TowerClaim = r.ReadBoolean("TowerClaim");
                client.HeadgearClaim = r.ReadBoolean("HeadgearClaim");
                client.InLottery = r.ReadBoolean("InLottery");
                client.LotteryEntries = r.ReadByte("LotteryEntries");
                // client.OldSkillsLoad = r.ReadBoolean("OldLoadSkills");
                client.Entity.SubClass = r.ReadByte("SubClass");
                client.Entity.SubClassLevel = r.ReadByte("SubClassLevel");
                //if (client.OldSkillsLoad)
                //{
                //    new MySqlCommand(MySqlCommandType.UPDATE).Update("entities").Set("OldLoadSkills", 0).Where("UID", client.Entity.UID).Execute();
                //    var cmdd = new MySqlCommand(MySqlCommandType.INSERT);
                //    cmdd.Insert("n_skills").Insert("EntityID", client.Entity.UID);
                //    cmdd.Execute();
                //}
                client.LastLotteryEntry = DateTime.FromBinary(r.ReadInt64("LastLotteryEntry"));
                if (client.Entity.MapID >= 7008)
                {
                    client.Entity.MapID = 1002;
                    client.Entity.X = 430;
                    client.Entity.Y = 380;
                }
                client.Entity.ReincarnationLev = r.ReadByte("ReincarnationLev");
                client.Entity.PreviousMapID = r.ReadUInt16("PreviousMapID");
                client.Entity.PKPoints = r.ReadUInt16("PKPoints");
                client.Entity.Class = r.ReadByte("Class");
                client.Entity.Reborn = r.ReadByte("Reborn");
                client.Entity.Level = r.ReadByte("Level");
                client.Entity.FirstRebornClass = r.ReadByte("FirstRebornClass");
                client.Entity.SecondRebornClass = r.ReadByte("SecondRebornClass");
                client.Entity.FirstRebornLevel = r.ReadByte("FirstRebornLevel");
                client.Entity.SecondRebornLevel = r.ReadByte("SecondRebornLevel");
                client.LastDragonBallUse = DateTime.FromBinary(r.ReadInt64("LastDragonBallUse"));
                client.LastResetTime = DateTime.FromBinary(r.ReadInt64("LastResetTime"));
                client.Entity.EnlightenPoints = r.ReadUInt16("EnlightenPoints");
                client.Entity.EnlightmentTime = r.ReadUInt16("EnlightmentWait");
                if (client.Entity.EnlightmentTime > 0)
                {
                    if (client.Entity.EnlightmentTime % 20 > 0)
                    {
                        client.Entity.EnlightmentTime -= (ushort)(client.Entity.EnlightmentTime % 20);
                        client.Entity.EnlightmentTime += 20;
                    }
                }
                client.Entity.ReceivedEnlightenPoints = r.ReadByte("EnlightsReceived");
                client.Entity.DoubleExperienceTime = r.ReadUInt16("DoubleExpTime");
                client.DoubleExpToday = r.ReadBoolean("DoubleExpToday");
                client.Entity.HeavenBlessing = r.ReadUInt32("HeavenBlessingTime");
                client.Entity.VIPLevel = r.ReadByte("VIPLevel");
                client.Entity.PrevX = r.ReadUInt16("PreviousX");
                client.Entity.Guild_points = r.ReadUInt32("GuildPoints");
                client.Entity.PrevY = r.ReadUInt16("PreviousY");
                client.ExpBalls = r.ReadByte("ExpBalls");
                client.Entity.AddFlower = r.ReadUInt16("Flower");

                // client.Entity.VotsPoints = r.ReadUInt16("VotsPoints");
                // long timer = r.ReadInt64("TimerVot");
                //// if (timer == 0)
                //// {
                //     client.Entity.TimerVot = DateTime.Now;
                //     client.Entity.SaveTimeVot();
                // }
                // client.Entity.TimerVot = DateTime.FromBinary(timer);

                if (client.Entity.MapID == 601)
                    client.OfflineTGEnterTime = DateTime.FromBinary(r.ReadInt64("OfflineTGEnterTime"));

                if (ServerBase.Kernel.Guilds.ContainsKey(r.ReadUInt16("GuildID")))
                {
                    client.Guild = ServerBase.Kernel.Guilds[r.ReadUInt16("GuildID")];
                    if (client.Guild.Members.ContainsKey(client.Entity.UID))
                    {
                        client.AsMember = client.Guild.Members[client.Entity.UID];
                        if (client.AsMember.GuildID == 0)
                        {
                            client.AsMember = null;
                            client.Guild = null;
                        }
                        else
                        {
                            client.Entity.GuildID = (ushort)client.Guild.ID;
                            client.Entity.GuildRank = (ushort)client.AsMember.Rank;
                        }
                    }
                    else
                        client.Guild = null;
                }
                if (!Game.ConquerStructures.Nobility.Board.TryGetValue(client.Entity.UID, out client.NobilityInformation))
                {
                    client.NobilityInformation = new Conquer_Online_Server.Game.ConquerStructures.NobilityInformation();
                    client.NobilityInformation.EntityUID = client.Entity.UID;
                    client.NobilityInformation.Name = client.Entity.Name;
                    client.NobilityInformation.Donation = 0;
                    client.NobilityInformation.Rank = Conquer_Online_Server.Game.ConquerStructures.NobilityRank.Serf;
                    client.NobilityInformation.Position = -1;
                    client.NobilityInformation.Gender = 1;
                    client.NobilityInformation.Mesh = client.Entity.Mesh;
                    if (client.Entity.Body % 10 >= 3)
                        client.NobilityInformation.Gender = 0;
                }
                else
                    client.Entity.NobilityRank = client.NobilityInformation.Rank;

                if (DateTime.Now.DayOfYear != client.LastResetTime.DayOfYear)
                {
                    if (client.Entity.Level >= 90)
                    {
                        client.Entity.EnlightenPoints = 100;
                        if (client.Entity.NobilityRank == Conquer_Online_Server.Game.ConquerStructures.NobilityRank.Knight ||
                            client.Entity.NobilityRank == Conquer_Online_Server.Game.ConquerStructures.NobilityRank.Baron)
                            client.Entity.EnlightenPoints += 100;
                        else if (client.Entity.NobilityRank == Conquer_Online_Server.Game.ConquerStructures.NobilityRank.Earl ||
                            client.Entity.NobilityRank == Conquer_Online_Server.Game.ConquerStructures.NobilityRank.Duke)
                            client.Entity.EnlightenPoints += 200;
                        else if (client.Entity.NobilityRank == Conquer_Online_Server.Game.ConquerStructures.NobilityRank.Prince)
                            client.Entity.EnlightenPoints += 300;
                        else if (client.Entity.NobilityRank == Conquer_Online_Server.Game.ConquerStructures.NobilityRank.King)
                            client.Entity.EnlightenPoints += 400;
                        if (client.Entity.VIPLevel != 0)
                        {
                            if (client.Entity.VIPLevel <= 3)
                                client.Entity.EnlightenPoints += 100;
                            else if (client.Entity.VIPLevel <= 5)
                                client.Entity.EnlightenPoints += 200;
                            else if (client.Entity.VIPLevel == 6)
                                client.Entity.EnlightenPoints += 300;
                        }
                    }
                    client.Entity.ReceivedEnlightenPoints = 0;
                    client.DoubleExpToday = false;
                    client.ExpBalls = 0;
                    client.Entity.AddFlower = 1;
                    client.LastResetTime = DateTime.Now;
                }
                Game.ConquerStructures.Arena.ArenaStatistics.TryGetValue(client.Entity.UID, out client.ArenaStatistic);
                if (client.ArenaStatistic == null || client.ArenaStatistic.EntityID == 0)
                {
                    client.ArenaStatistic = new Conquer_Online_Server.Network.GamePackets.ArenaStatistic(true);
                    client.ArenaStatistic.EntityID = client.Entity.UID;
                    client.ArenaStatistic.Name = client.Entity.Name;
                    client.ArenaStatistic.Level = client.Entity.Level;
                    client.ArenaStatistic.Class = client.Entity.Class;
                    client.ArenaStatistic.Model = client.Entity.Mesh;
                    client.ArenaStatistic.ArenaPoints = ArenaTable.ArenaPointFill(client.Entity.Level);
                    client.ArenaStatistic.LastArenaPointFill = DateTime.Now;
                    ArenaTable.InsertArenaStatistic(client);
                    client.ArenaStatistic.Status = Network.GamePackets.ArenaStatistic.NotSignedUp;
                    Game.ConquerStructures.Arena.ArenaStatistics.Add(client.Entity.UID, client.ArenaStatistic);
                }
                else
                {
                    client.ArenaStatistic.Level = client.Entity.Level;
                    client.ArenaStatistic.Class = client.Entity.Class;
                    client.ArenaStatistic.Model = client.Entity.Mesh;
                    if (DateTime.Now.DayOfYear != client.ArenaStatistic.LastArenaPointFill.DayOfYear)
                    {
                        client.ArenaStatistic.LastSeasonArenaPoints = client.ArenaStatistic.ArenaPoints;
                        client.ArenaStatistic.LastSeasonWin = client.ArenaStatistic.TodayWin;
                        client.ArenaStatistic.LastSeasonLose = client.ArenaStatistic.TodayBattles - client.ArenaStatistic.TodayWin;
                        client.ArenaStatistic.ArenaPoints = ArenaTable.ArenaPointFill(client.Entity.Level);
                        client.ArenaStatistic.LastArenaPointFill = DateTime.Now;
                        client.ArenaStatistic.TodayWin = 0;
                        client.ArenaStatistic.TodayBattles = 0;
                        Game.ConquerStructures.Arena.Sort();
                        Game.ConquerStructures.Arena.YesterdaySort();
                    }
                }
                if (r.ReadUInt32("ClanID") != 0)
                {
                    if (Conquer_Online_Server.ServerBase.Kernel.ServerClans.ContainsKey(r.ReadUInt32("ClanID")))
                    {
                        client.Entity.ClanId = r.ReadUInt32("ClanID");
                        client.Entity.Myclan = Conquer_Online_Server.ServerBase.Kernel.ServerClans[r.ReadUInt32("ClanID")];
                        client.Entity.ClanName = client.Entity.Myclan.ClanName;
                        client.Entity.ClanRank = (byte)client.Entity.Myclan.Members[client.Entity.UID].Rank;
                    }
                }

                // client.Entity.SubClasses.Active = client.Entity.SubClass;
                client.Entity.SubClasses.StudyPoints = r.ReadUInt64("StudyPoints");
                r.Close();
                SubClassTable.Load(client.Entity);
                SkillTable.LoadProficiencies(client);
                SkillTable.LoadSpells(client);
                KnownPersons.LoadKnownPersons(client);
                ConquerItemTable.LoadItems(client);
                DetainedItemTable.LoadClaimableItems(client);
                DetainedItemTable.LoadDetainedItems(client);
                Database.EntityTable.LoadTop2(client);
                EliteTournament.LoginClient2(client);

                client.Entity.FullyLoaded = true;
            }
            else
                return false;
            return true;
        }
示例#12
0
 public static void Load()
 {
     MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT);
     command.Select("spells");
     MySqlReader reader = new MySqlReader(command);
     while (reader.Read())
     {
         SpellInformation spell = new SpellInformation();
         spell.ID = reader.ReadUInt16("type");
         spell.Sort = reader.ReadByte("sort");
         spell.CanKill = reader.ReadBoolean("crime");
         spell.OnlyGround = reader.ReadBoolean("ground");
         spell.Multi = reader.ReadBoolean("multi");
         spell.Target = reader.ReadByte("target");
         spell.Level = reader.ReadByte("level");
         spell.UseMana = reader.ReadUInt16("use_mp");
         spell.UseStamina = reader.ReadByte("use_ep");
         spell.UseArrows = reader.ReadByte("use_item_num");
         spell.Power = reader.ReadUInt16("power");
         spell.PowerPercent = (float)(reader.ReadUInt16("power") % 1000) / 100;
         if (spell.Power > 13000)
             spell.Power = 0;
         spell.Percent = reader.ReadByte("percent");
         spell.Duration = reader.ReadInt32("step_secs");
         spell.Range = reader.ReadUInt16("range");
         spell.Sector = spell.Range * 20;
         spell.Distance = reader.ReadUInt16("distance");
         if (spell.Distance >= 4) spell.Distance--;
         spell.Status = reader.ReadUInt64("status");
         spell.NeedExperience = reader.ReadUInt32("need_exp");
         spell.NeedLevel = reader.ReadByte("need_level");
         spell.WeaponSubtype = spell.OnlyWithThisWeaponSubtype = reader.ReadUInt16("weapon_subtype");
         spell.NextSpellID = reader.ReadUInt16("next_magic");
         spell.NeedXP = reader.ReadByte("use_xp");
         if (SpellInformations.ContainsKey(spell.ID))
         {
             SpellInformations[spell.ID].Add(spell.Level, spell);
         }
         else
         {
             SpellInformations.Add(spell.ID, new SafeDictionary<byte, SpellInformation>(10));
             SpellInformations[spell.ID].Add(spell.Level, spell);
         }
         if (spell.Distance > 17)
             spell.Distance = 17;
         if (spell.WeaponSubtype != 0)
         {
             switch (spell.ID)
             {
                 case 5010:
                 case 7020:
                 case 1290:
                 case 1260:
                 case 5030:
                 case 5040:
                 case 7000:
                 case 7010:
                 case 7030:
                 case 7040:
                 case 1250:
                 case 5050:
                 case 5020:
                 case 10490:
                 case 1300:
                     if (spell.Distance >= 3)
                         spell.Distance = 3;
                     if (spell.Range > 3)
                         spell.Range = 3;
                     if (!WeaponSpells.ContainsKey(spell.WeaponSubtype))
                     {
                         WeaponSpells.Add(spell.WeaponSubtype, spell.ID);
                     }
                     break;
             }
         }
     }
     reader.Close();
     Console.WriteLine("Spells information loaded.");
 }