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(); } }
public AccountTable(string username) { if (BannedIPs.Count == 0 && !LoadedIPs) { string[] lines = File.ReadAllLines(ServerBase.Constants.BannedPath); foreach (string line in lines) { if (line.Length >= 7) { BannedIPs.Add(line.Split(new char[] { '\n', '\r' }, StringSplitOptions.RemoveEmptyEntries)[0]); } } LoadedIPs = true; } this.Username = username; this.Password = ""; this.IP = ""; this.LastCheck = DateTime.Now; this.State = AccountState.DoesntExist; this.EntityID = 0; MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("accounts").Where("Username", username); MySqlReader r = new MySqlReader(cmd); if (r.Read()) { exists = true; this.Password = r.ReadString("Password"); this.IP = r.ReadString("IP"); this.EntityID = r.ReadUInt32("EntityID"); this.LastCheck = DateTime.FromBinary(r.ReadInt64("LastCheck")); this.State = (AccountState)r.ReadByte("State"); this.Email = r.ReadString("Email"); } r.Close(); }
public static void GetAddingsForItem(Interfaces.IConquerItem item) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("itemadding").Where("UID", item.UID); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { uint type = r.ReadUInt32("addingtype"); if (type == 0) { ItemAdding.Purification_ purification = new ItemAdding.Purification_(); purification.ItemUID = item.UID; purification.Available = true; purification.PurificationItemID = r.ReadUInt32("addingid"); purification.PurificationDuration = r.ReadUInt32("duration"); purification.PurificationLevel = r.ReadUInt32("addinglevel"); purification.AddedOn = DateTime.FromBinary(r.ReadInt64("addedon")); if (purification.PurificationDuration != 0) { TimeSpan span1 = new TimeSpan(purification.AddedOn.AddSeconds(purification.PurificationDuration).Ticks); TimeSpan span2 = new TimeSpan(DateTime.Now.Ticks); int secondsleft = (int)(span1.TotalSeconds - span2.TotalSeconds); if (secondsleft <= 0) { purification.Available = false; RemoveAdding(item.UID, purification.PurificationItemID); continue; } } item.Purification = purification; } else { ItemAdding.Refinery_ extraeffect = new ItemAdding.Refinery_(); extraeffect.ItemUID = item.UID; extraeffect.Available = true; extraeffect.EffectID = r.ReadUInt32("addingid"); extraeffect.EffectLevel = r.ReadUInt32("addinglevel"); extraeffect.EffectPercent = r.ReadUInt32("addingpercent"); extraeffect.EffectDuration = r.ReadUInt32("duration"); extraeffect.AddedOn = DateTime.FromBinary(r.ReadInt64("addedon")); if (extraeffect.EffectDuration != 0) { TimeSpan span1 = new TimeSpan(extraeffect.AddedOn.AddSeconds(extraeffect.EffectDuration).Ticks); TimeSpan span2 = new TimeSpan(DateTime.Now.Ticks); int secondsleft = (int)(span1.TotalSeconds - span2.TotalSeconds); if (secondsleft <= 0) { extraeffect.Available = false; RemoveAdding(item.UID, extraeffect.EffectID); continue; } } item.ExtraEffect = extraeffect; } } r.Close(); }
public static void getVipInfo(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("premium").Where("EntityName", client.Entity.Name); MySqlReader rdr = new MySqlReader(cmd); if (rdr.Read()) { client.VIPDate = DateTime.FromBinary(rdr.ReadInt64("VipStartDate")); client.VIPDays = rdr.ReadUInt32("VipDays"); rdr.Close(); } }
public static bool CreateEntity(Network.GamePackets.EnitityCreate eC, Client.GameState client, ref string message) { if (eC.Name.Length > 16) eC.Name = eC.Name.Substring(0, 16); if (eC.Name == "") return false; if (InvalidCharacters(eC.Name)) { message = "Invalid characters inside the name."; return false; } var rdr = new MySqlReader(new MySqlCommand(MySqlCommandType.SELECT).Select("entities").Where("name", eC.Name)); if (rdr.Read()) { rdr.Close(); message = "The chosen name is already in use."; return false; } rdr.Close(); client.Entity = new Game.Entity(Game.EntityFlag.Player, false); client.Entity.Name = eC.Name; DataHolder.GetStats(eC.Class, 1, client); client.Entity.UID = Program.EntityUID.Next; new MySqlCommand(MySqlCommandType.UPDATE).Update("configuration").Set("EntityID", client.Entity.UID).Where("Server", ServerBase.Constants.ServerName).Execute(); client.CalculateStatBonus(); client.CalculateHPBonus(); client.Entity.Hitpoints = client.Entity.MaxHitpoints; client.Entity.Mana = (ushort)(client.Entity.Spirit * 5); client.Entity.Class = eC.Class; client.Entity.Body = eC.Body; if (eC.Body == 1003 || eC.Body == 1004) client.Entity.Face = (ushort)ServerBase.Kernel.Random.Next(1, 50); else client.Entity.Face = (ushort)ServerBase.Kernel.Random.Next(201, 250); byte Color = (byte)ServerBase.Kernel.Random.Next(4, 8); client.Entity.HairStyle = (ushort)(Color * 100 + 10 + (byte)ServerBase.Kernel.Random.Next(4, 9)); client.Account.EntityID = client.Entity.UID; client.Account.Save(); //723753 MySqlCommand cmd = new MySqlCommand(MySqlCommandType.INSERT); cmd.Insert("entities").Insert("Name", eC.Name).Insert("Owner", client.Account.Username).Insert("Class", eC.Class).Insert("UID", client.Entity.UID) .Insert("Hitpoints", client.Entity.Hitpoints).Insert("Mana", client.Entity.Mana).Insert("Body", client.Entity.Body) .Insert("Face", client.Entity.Face).Insert("HairStyle", client.Entity.HairStyle).Insert("Strength", client.Entity.Strength) .Insert("Agility", client.Entity.Agility).Insert("Vitality", client.Entity.Vitality).Insert("Spirit", client.Entity.Spirit); cmd.Execute(); message = "ANSWER_OK"; return true; }
public static void Load(Game.Entity Entity) { MySqlCommand Command = new MySqlCommand(MySqlCommandType.SELECT); Command.Select("subclasses").Where("id", Entity.UID); MySqlReader Reader = new MySqlReader(Command); while (Reader.Read()) { Game.SubClass Sub = new Game.SubClass(); Sub.ID = Reader.ReadByte("uid"); Sub.Level = Reader.ReadByte("level"); Sub.Phase = Reader.ReadByte("phase"); Entity.SubClasses.Classes.Add(Sub.ID, Sub); } Reader.Close(); }
public static bool ContainsArsenal(ushort gID) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("guild_arsenals").Where("guild_uid", gID).Execute(); MySqlReader r = new MySqlReader(cmd); if (r.Read()) { r.Close(); return true; } else { r.Close(); return false; } }
public static void Load() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("HorseRace"); MySqlReader reader = new MySqlReader(cmd); while (reader.Read()) { Network.GamePackets.HorseRaceStatistic stat = new Network.GamePackets.HorseRaceStatistic(true); stat.Name = reader.ReadString("EntityName"); stat.EntityID = reader.ReadUInt32("EntityID"); stat.Rank = reader.ReadByte("Rank"); stat.CurrentPts = reader.ReadUInt32("CurrentPts"); Game.ConquerStructures.Society.HorseRace.HorseRaceStatistic.Add(stat.EntityID, stat); } reader.Close(); }
public static bool Contains(Game.Entity Entity, byte id) { bool Return = false; MySqlCommand Command = new MySqlCommand(MySqlCommandType.SELECT); Command.Select("subclasses").Where("id", Entity.UID).And("uid", id); MySqlReader Reader = new MySqlReader(Command); if (Reader.Read()) { if (Reader.ReadByte("uid") == id) { Return = true; } } Reader.Close(); return Return; }
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."); }
public static void Load() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("nobility"); MySqlReader reader = new MySqlReader(cmd); while (reader.Read()) { Game.ConquerStructures.NobilityInformation nobilityinfo = new Conquer_Online_Server.Game.ConquerStructures.NobilityInformation(); nobilityinfo.EntityUID = reader.ReadUInt32("EntityUID"); nobilityinfo.Name = reader.ReadString("EntityName"); nobilityinfo.Donation = reader.ReadUInt64("Donation"); nobilityinfo.Gender = reader.ReadByte("Gender"); nobilityinfo.Mesh = reader.ReadUInt32("Mesh"); Game.ConquerStructures.Nobility.Board.Add(nobilityinfo.EntityUID, nobilityinfo); } reader.Close(); Game.ConquerStructures.Nobility.Sort(0); Console.WriteLine("Nobility information loaded."); }
public static void getVp(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("premium").Where("EntityName", client.Entity.Name).Or("Username", client.Account.Username); MySqlReader rdr = new MySqlReader(cmd); if (rdr.Read()) { client.VotePoints = rdr.ReadUInt32("VotePoint"); rdr.Close(); } else { client.VotePoints = 0; MySqlCommand Do = new MySqlCommand(MySqlCommandType.INSERT); Do.Insert("premium").Insert("EntityName", client.Entity.Name).Insert("Username", client.Account.Username).Insert("VotePoint", 0).Insert("IP", client.IP).Execute(); rdr.Close(); } }
public static void Load() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("arena"); MySqlReader reader = new MySqlReader(cmd); while (reader.Read()) { Network.GamePackets.ArenaStatistic stat = new Network.GamePackets.ArenaStatistic(true); stat.EntityID = reader.ReadUInt32("EntityID"); stat.Name = reader.ReadString("EntityName"); stat.LastSeasonRank = reader.ReadUInt32("LastSeasonRank"); stat.LastSeasonArenaPoints = reader.ReadUInt32("LastSeasonArenaPoints"); stat.ArenaPoints = reader.ReadUInt32("ArenaPoints"); stat.TodayWin = reader.ReadByte("TodayWin"); stat.TodayBattles = reader.ReadByte("TodayBattles"); // doesn't exist in the DB, removed it stat.LastSeasonWin = reader.ReadUInt32("LastSeasonWin"); stat.LastSeasonLose = reader.ReadUInt32("LastSeasonLose"); stat.TotalWin = reader.ReadUInt32("TotalWin"); stat.TotalLose = reader.ReadUInt32("TotalLose"); stat.HistoryHonor = reader.ReadUInt32("HistoryHonor"); stat.CurrentHonor = reader.ReadUInt32("CurrentHonor"); stat.Level = reader.ReadByte("Level"); stat.Class = reader.ReadByte("Class"); stat.Model = reader.ReadUInt32("Model"); stat.LastArenaPointFill = DateTime.FromBinary(reader.ReadInt64("ArenaPointFill")); if (DateTime.Now.DayOfYear != stat.LastArenaPointFill.DayOfYear) { stat.LastSeasonArenaPoints = stat.ArenaPoints; stat.LastSeasonWin = stat.TodayWin; stat.LastSeasonLose = stat.TodayBattles - stat.TodayWin; stat.ArenaPoints = ArenaPointFill(stat.Level); stat.LastArenaPointFill = DateTime.Now; stat.TodayWin = 0; stat.TodayBattles = 0; } Game.ConquerStructures.Arena.ArenaStatistics.Add(stat.EntityID, stat); } reader.Close(); Game.ConquerStructures.Arena.Sort(); Game.ConquerStructures.Arena.YesterdaySort(); Console.WriteLine("Arena information loaded."); }
public static void Load() { MySqlCommand command = new MySqlCommand(MySqlCommandType.SELECT); command.Select("lottery"); MySqlReader reader = new MySqlReader(command); while (reader.Read()) { LotteryItem item = new LotteryItem(); item.Rank = reader.ReadInt32("rank"); item.Chance = reader.ReadInt32("chance"); item.Name = reader.ReadString("prize_name"); item.ID = reader.ReadUInt32("prize_item"); item.Color = reader.ReadByte("color"); item.Sockets = reader.ReadByte("hole_num"); item.Plus = reader.ReadByte("addition_lev"); LotteryItems.Add(item); } reader.Close(); Console.WriteLine("Lottery items loaded."); }
public static void LoadFlower() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("cq_flowers"); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { Game.Struct.Flowers F = new Game.Struct.Flowers(); F.Lilies = r.ReadInt32("lilies"); F.Lilies2day = r.ReadInt32("liliestoday"); F.Orchads = r.ReadInt32("orchads"); F.Orchads2day = r.ReadInt32("orchadstoday"); F.RedRoses = r.ReadInt32("redroses"); F.RedRoses2day = r.ReadInt32("redrosestoday"); F.Tulips = r.ReadInt32("tulips"); F.Tulips2day = r.ReadInt32("tulipstoday"); Conquer_Online_Server.ServerBase.Kernel.AllFlower.Add(r.ReadUInt32("charuid"), F); } r.Close(); }
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(); }
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; }
public static bool CanVote(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("votes").Where("Username", client.Account.Username); MySqlReader rdr = new MySqlReader(cmd); if (rdr.Read()) { string date = rdr.ReadString("ServerDate"); date = date.Replace("-", "/"); if (date.StartsWith("0") || date.Length < 4) date = "2011/01/01 01:01:01"; client.LastVote = ParseString(date); rdr.Close(); if (DateTime.Now >= client.LastVote.AddHours(12)) return true; else return false; } rdr.Close(); return true; }
public static bool canLotto(Client.GameState client, ref bool New) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("quest").Where("EntityName", client.Entity.Name).Or("IP", client.IP); MySqlReader rdr = new MySqlReader(cmd); if (rdr.Read()) { New = false; client.LastLotteryEntry = DateTime.FromBinary(rdr.ReadInt64("LottoDate")); client.LotteryEntries = rdr.ReadByte("LottoTries"); if (client.LotteryEntries <= 9) { rdr.Close(); return true; } else if (DateTime.Now.DayOfYear != client.LastLotteryEntry.DayOfYear) { client.LotteryEntries = 0; MySqlCommand Do = new MySqlCommand(MySqlCommandType.UPDATE); Do.Update("quest").Set("LottoDate", DateTime.Now.Ticks).Set("LottoTries", 0).Where("EntityName", client.Entity.Name).Or("IP", client.IP).Execute(); rdr.Close(); return true; } else { rdr.Close(); return false; } } else { rdr.Close(); New = true; return true; } }
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."); }
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."); }
public static void LoadClaimableItems(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("detaineditems").Where("GainerUID", client.Entity.UID); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { DetainedItem item = new DetainedItem(true); item.ItemUID = r.ReadUInt32("ItemUID"); item.UID = item.ItemUID - 1; item.Page = (byte)DetainedItem.ClaimPage; item.Item = ConquerItemTable.LoadItem(item.ItemUID); item.ConquerPointsCost = r.ReadUInt32("ConquerPointsCost"); item.OwnerUID = r.ReadUInt32("GainerUID"); item.GainerName = r.ReadString("GainerName"); item.GainerUID = r.ReadUInt32("OwnerUID"); item.OwnerName = r.ReadString("OwnerName"); item.Date = DateTime.FromBinary(r.ReadInt64("Date")); item.DaysLeft = (uint)(TimeSpan.FromTicks(DateTime.Now.Ticks).Days - TimeSpan.FromTicks(item.Date.Ticks).Days); if (item.GainerUID == 500) { item.MakeItReadyToClaim(); item.GainerUID = r.ReadUInt32("GainerUID"); item.OwnerUID = r.ReadUInt32("OwnerUID"); } client.ClaimableItem.Add(item.UID, item); } r.Close(); }
public static void Load(Game.ConquerStructures.Society.Guild g) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("guild_arsenalsdonation").Where("guild_uid", g.ID); MySqlReader r = new MySqlReader(cmd); SafeDictionary<uint, ArsenalSingle> ass = new SafeDictionary<uint, ArsenalSingle>(1000); while (r.Read()) { ArsenalSingle s = new ArsenalSingle(); s.D_UID = r.ReadUInt32("d_uid"); s.Name = r.ReadString("name"); s.UID = r.ReadUInt32("item_uid"); s.Donation = r.ReadUInt32("item_donation"); s.Type = (ArsenalType)r.ReadByte("item_arsenal_type"); ass.Add(s.UID, s); } r.Close(); foreach (ArsenalSingle s in ass.Values) { s.Item = ConquerItemTable.GetSingleItem(s.UID); g.Arsenal.Inscribe(s.Type, s); } ass = new SafeDictionary<uint, ArsenalSingle>(1000); ass = null; cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("guild_arsenals").Where("guild_uid", g.ID); r = new MySqlReader(cmd); if (r.Read()) { g.A_Packet.Headgear_Avaliable = r.ReadByte("head_allowed") == 1; g.A_Packet.Armor_Avaliable = r.ReadByte("armor_allowed") == 1; g.A_Packet.Weapon_Avaliable = r.ReadByte("weapon_allowed") == 1; g.A_Packet.Ring_Avaliable = r.ReadByte("ring_allowed") == 1; g.A_Packet.Boots_Avaliable = r.ReadByte("boots_allowed") == 1; g.A_Packet.Necklace_Avaliable = r.ReadByte("neck_allowed") == 1; g.A_Packet.Fan_Avaliable = r.ReadByte("fan_allowed") == 1; g.A_Packet.Tower_Avaliable = r.ReadByte("tower_allowed") == 1; } r.Close(); }
public static void LoadAllClans() { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("Clans"); MySqlReader r = new MySqlReader(cmd); while (r.Read()) { Game.Clans clan = new Conquer_Online_Server.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 (!Conquer_Online_Server.ServerBase.Kernel.ServerClans.ContainsKey(clan.ClanId)) Conquer_Online_Server.ServerBase.Kernel.ServerClans.Add(clan.ClanId, clan); } r.Close(); Console.WriteLine("Clans Loading " + Conquer_Online_Server.ServerBase.Kernel.ServerClans.Count); GetMembers(); foreach (Game.Clans c in ServerBase.Kernel.ServerClans.Values) { c.LoadAssociates(); } }
static void EngineThread_Execute() { Time32 Start = Time32.Now; RandomSeed = Convert.ToInt32(DateTime.Now.Ticks.ToString().Remove(DateTime.Now.Ticks.ToString().Length / 2)); ServerBase.Kernel.Random = new Random(RandomSeed); StartDate = DateTime.Now; //Console.Title = "Conquer Online Server Emulator. Start time: " + StartDate.ToString("dd MM yyyy hh:mm"); Console.BackgroundColor = ConsoleColor.Green; //Console.ForegroundColor = ConsoleColor.DarkRed; Console.BackgroundColor = ConsoleColor.Black; Console.ForegroundColor = ConsoleColor.White; Console.WriteLine("Load server configuration!"); string ConfigFileName = "configuration.ini"; ServerBase.IniFile IniFile = new ServerBase.IniFile(ConfigFileName); GameIP = IniFile.ReadString("configuration", "IP"); GamePort = IniFile.ReadUInt16("configuration", "GamePort"); AuthPort = IniFile.ReadUInt16("configuration", "AuthPort"); ServerBase.Constants.ServerName = IniFile.ReadString("configuration", "ServerName"); Database.DataHolder.CreateConnection(IniFile.ReadString("MySql", "Username"), IniFile.ReadString("MySql", "Password"), IniFile.ReadString("MySql", "Database"), IniFile.ReadString("MySql", "Host")); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("configuration").Where("Server", ServerBase.Constants.ServerName); MySqlReader r = new MySqlReader(cmd); if (r.Read()) { EntityUID = new ServerBase.Counter(r.ReadUInt32("EntityID")); Game.Clans.ClanCount = new Conquer_Online_Server.ServerBase.Counter(r.ReadUInt32("ClanUID")); Game.ConquerStructures.Society.Guild.GuildCounter = new Conquer_Online_Server.ServerBase.Counter(r.ReadUInt32("GuildID")); Network.GamePackets.ConquerItem.ItemUID = new Conquer_Online_Server.ServerBase.Counter(r.ReadUInt32("ItemUID")); ServerBase.Constants.ExtraExperienceRate = r.ReadUInt32("ExperienceRate"); ServerBase.Constants.ExtraSpellRate = r.ReadUInt32("ProficiencyExperienceRate"); ServerBase.Constants.ExtraProficiencyRate = r.ReadUInt32("SpellExperienceRate"); ServerBase.Constants.MoneyDropRate = r.ReadUInt32("MoneyDropRate"); ServerBase.Constants.MoneyDropMultiple = r.ReadUInt32("MoneyDropMultiple"); ServerBase.Constants.ConquerPointsDropRate = r.ReadUInt32("ConquerPointsDropRate"); ServerBase.Constants.ConquerPointsDropMultiple = r.ReadUInt32("ConquerPointsDropMultiple"); ServerBase.Constants.ItemDropRate = r.ReadUInt32("ItemDropRate"); ServerBase.Constants.ItemDropQualityRates = r.ReadString("ItemDropQualityString").Split('~'); ServerBase.Constants.WebAccExt = r.ReadString("AccountWebExt"); ServerBase.Constants.WebVoteExt = r.ReadString("VoteWebExt"); ServerBase.Constants.WebDonateExt = r.ReadString("DonateWebExt"); ServerBase.Constants.ServerWebsite = r.ReadString("ServerWebsite"); ServerBase.Constants.ServerGMPass = r.ReadString("ServerGMPass"); PlayerCap = r.ReadInt32("PlayerCap"); Database.DetainedItemTable.Counter = new Conquer_Online_Server.ServerBase.Counter(r.ReadUInt32("DetainItemUID")); } r.Close(); Console.WriteLine("Initializing database."); Database.ConquerItemInformation.Load(); Database.DataHolder.ReadStats(); Database.MonsterInformation.Load(); Database.SpellTable.Load(); Database.ShopFile.Load(); Database.EShopFile.Load(); Database.MapsTable.Load(); Database.NobilityTable.Load(); Database.ArenaTable.Load(); Database.GuildTable.Load(); Database.LotteryTable.Load(); Database.DMaps.Load(); Database.EntityTable.LoadPlayersVots(); Database.LotteryTable2.Load(); Database.EntityTable.NextUit(); // Database.DROP_SOULS.LoadDrops(); Database.Clans.LoadAllClans(); ServerBase.FrameworkTimer.SetPole(100, 50); System.Threading.ThreadPool.QueueUserWorkItem(new System.Threading.WaitCallback(ServerBase.FrameworkTimer.DoNothing)); Values = new Client.GameState[0]; new Game.Map(1038, Database.DMaps.MapPaths[1038]); Game.ConquerStructures.Society.GuildWar.Initiate(); Console.WriteLine("Guild war initializated."); Network.AuthPackets.Forward.Incrementer = new ServerBase.Counter(); Network.Cryptography.AuthCryptography.PrepareAuthCryptography(); ServerBase.Kernel.Elite_PK_Tournament = new Conquer_Online_Server.Game.Tournaments.EliteTournament(); ServerBase.Kernel.Elite_PK_Tournament.LoadTop8(); Console.WriteLine("Initializing sockets."); AuthServer = new AsyncSocket(AuthPort); AuthServer.OnClientConnect += new Action<Interfaces.ISocketWrapper>(AuthServer_AnnounceNewConnection); AuthServer.OnClientReceive += new Action<byte[], Interfaces.ISocketWrapper>(AuthServer_AnnounceReceive); AuthServer.OnClientDisconnect += new Action<Interfaces.ISocketWrapper>(AuthServer_AnnounceDisconnection); GameServer = new AsyncSocket(GamePort); GameServer.OnClientConnect += new Action<Interfaces.ISocketWrapper>(GameServer_AnnounceNewConnection); GameServer.OnClientReceive += new Action<byte[], Interfaces.ISocketWrapper>(GameServer_AnnounceReceive); GameServer.OnClientDisconnect += new Action<Interfaces.ISocketWrapper>(GameServer_AnnounceDisconnection); Console.WriteLine("Authentication server on port " + AuthPort + "is online."); Console.WriteLine("Game server on port " + GamePort + "is online."); Console.WriteLine(); Console.WriteLine("Server loaded in " + (Time32.Now - Start) + " milliseconds."); StatusFlagChange.Execute += new Action(StatusFlagChange_Execute); StatusFlagChange.Start(); CharacterThread.Execute += new Action(CharacterThread_Execute); CharacterThread.Start(); AttackThread.Execute += new Action(AttackThread_Execute); AttackThread.Start(); CompanionThread.Execute += new Action(CompanionThread_Execute); CompanionThread.Start(); BlessThread.Execute += new Action(BlessThread_Execute); BlessThread.Start(); CharacterThread.Execute += new Action(CharacterThread_Execute); CharacterThread.Start(); ServerStuff.Execute += new Action(ServerStuff_Execute); ServerStuff.Start(); ArenaSystem.Execute += new Action(Game.ConquerStructures.Arena.ArenaSystem_Execute); ArenaSystem.Start(); new MySqlCommand(MySqlCommandType.UPDATE).Update("entities").Set("Online", 0).Execute(); GC.Collect(); System.Threading.Thread.Sleep(000); Console.WriteLine("----------------Source 5620--------------"); while (true) CommandsAI(Console.ReadLine()); }
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(); }
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(); }
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(); }
public static bool IsThere(uint uid) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("items").Where("UID", uid); var r = new MySqlReader(cmd); if (r.Read()) { r.Close(); return true; } r.Close(); return false; }
static bool inPremium(Client.GameState client) { MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT); cmd.Select("premium").Where("Username", client.Account.Username); MySqlReader rdr = new MySqlReader(cmd); if (rdr.Read()) { rdr.Close(); return true; } else { rdr.Close(); MySqlCommand Do = new MySqlCommand(MySqlCommandType.INSERT); Do.Insert("premium").Insert("EntityName", client.Entity.Name).Insert("Username", client.Account.Username).Insert("IP", client.IP).Execute(); return true; } }