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); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.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.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(); //r.Close(); r.Dispose(); return item; }
/* public static void save(Entity Entity, Statement.SubClass SubClass) { MySqlCommand Command = new MySqlCommand(MySqlCommandType.UPDATE); Command.Update("subclasses") .Set("phase", SubClass.Phase) .Set("level", SubClass.Level) .Where("id", Entity.UID) .And("uid", SubClass.ID) .Execute(); }*/ public static bool Contains(Entity Entity, byte id) { bool Return = false; MySqlCommand Command = new MySqlCommand(MySqlCommandType.SELECT); Command.Select("subclasses").Where("id", Entity.UID).And("uid", id); PhoenixProject.Database.MySqlReader Reader = new PhoenixProject.Database.MySqlReader(Command); if (Reader.Read()) { if (Reader.ReadByte("uid") == id) Return = true; } return Return; }
public static void LoadSpells(Client.GameState client, MySql.Data.MySqlClient.MySqlConnection conn) { if (client.Entity == null) return; client.Spells = new System.SafeDictionary<ushort, Interfaces.ISkill>(100); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("skills").Where("EntityID", client.Entity.UID); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.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.TempLevel = r.ReadByte("TempLevel"); spell.Available = true; if (!client.Spells.ContainsKey(spell.ID)) client.Spells.Add(spell.ID, spell); } r.Close(); r.Dispose(); }
public static void LoadProficiencies(Client.GameState client) { if (client.Entity == null) return; client.Proficiencies = new System.SafeDictionary<ushort, Interfaces.IProf>(100); MySqlCommand cmd = new MySqlCommand(MySqlCommandType.SELECT).Select("profs").Where("EntityID", client.Entity.UID); PhoenixProject.Database.MySqlReader r = new PhoenixProject.Database.MySqlReader(cmd); while (r.Read()) { Interfaces.IProf proficiency = new Network.GamePackets.Proficiency(true); proficiency.ID = r.ReadUInt16("ID"); proficiency.Level = r.ReadByte("Level"); proficiency.PreviousLevel = r.ReadByte("PreviousLevel"); proficiency.Experience = r.ReadUInt32("Experience"); proficiency.TempLevel = r.ReadByte("TempLevel"); proficiency.Available = true; if (!client.Proficiencies.ContainsKey(proficiency.ID)) client.Proficiencies.Add(proficiency.ID, proficiency); } 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 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 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."); }
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(); }