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 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."); }