示例#1
0
 public ItemDropDataItem(SerializationInfo _Info, StreamingContext _Context)
 {
     m_Boss       = (WowBoss)_Info.GetInt32("m_Boss");
     m_DropChance = _Info.GetSingle("m_DropChance");
 }
示例#2
0
        public ItemDropDatabase(string _RootPath)
        {
            try
            {
                if (System.IO.File.Exists(_RootPath + "\\ItemDropDatabase.dat") == true)
                {
                    Utility.LoadSerialize(_RootPath + "\\ItemDropDatabase.dat", out m_Database);
                    m_Database.AddToList(19951, new ItemDropDataItem(WowBoss.Edge_Of_Madness, 0.0f)); //Warrior
                    m_Database.AddToList(19952, new ItemDropDataItem(WowBoss.Edge_Of_Madness, 0.0f)); //Paladin
                    m_Database.AddToList(19953, new ItemDropDataItem(WowBoss.Edge_Of_Madness, 0.0f)); //Hunter
                    m_Database.AddToList(19954, new ItemDropDataItem(WowBoss.Edge_Of_Madness, 0.0f)); //Rogue
                    m_Database.AddToList(19955, new ItemDropDataItem(WowBoss.Edge_Of_Madness, 0.0f)); //Druid
                    m_Database.AddToList(19956, new ItemDropDataItem(WowBoss.Edge_Of_Madness, 0.0f)); //Shaman
                    m_Database.AddToList(19957, new ItemDropDataItem(WowBoss.Edge_Of_Madness, 0.0f)); //Warlock
                    m_Database.AddToList(19958, new ItemDropDataItem(WowBoss.Edge_Of_Madness, 0.0f)); //Priest
                    m_Database.AddToList(19959, new ItemDropDataItem(WowBoss.Edge_Of_Madness, 0.0f)); //Mage

                    List <ItemDropDataItem> items;
                    //m_Database.RemoveFromList(18665, new ItemDropDataItem(WowBoss.Kazzak, 0.0f));//Remove The Eye of Shadow from Kazzak
                    if (m_Database.TryGetValue(18665, out items) == true)
                    {
                        for (int i = 0; i < items.Count; ++i)
                        {
                            if (items[i].m_Boss == WowBoss.Kazzak)
                            {
                                items.RemoveAt(i);
                                --i;
                            }
                        }
                    }
                    //m_Database.RemoveFromList(18608, new ItemDropDataItem(WowBoss.Kazzak, 0.0f));//Remove Benediction from Kazzak
                    if (m_Database.TryGetValue(18608, out items) == true)
                    {
                        for (int i = 0; i < items.Count; ++i)
                        {
                            if (items[i].m_Boss == WowBoss.Kazzak)
                            {
                                items.RemoveAt(i);
                                --i;
                            }
                        }
                    }
                    //m_Database.RemoveFromList(18609, new ItemDropDataItem(WowBoss.Kazzak, 0.0f));//Remove Anathema from Kazzak
                    if (m_Database.TryGetValue(18609, out items) == true)
                    {
                        for (int i = 0; i < items.Count; ++i)
                        {
                            if (items[i].m_Boss == WowBoss.Kazzak)
                            {
                                items.RemoveAt(i);
                                --i;
                            }
                        }
                    }
                }
                else
                {
                    m_Database = new Dictionary <int, List <ItemDropDataItem> >();
                    foreach (string rawDBFile in sm_rawDBFiles)
                    {
                        if (System.IO.File.Exists(_RootPath + "\\ItemDropRawData\\" + rawDBFile) == true)
                        {
                            try
                            {
                                string atlasLootItems;
                                {
                                    var allText      = System.IO.File.ReadAllText(_RootPath + "\\ItemDropRawData\\" + rawDBFile);
                                    var splittedText = allText.Split(sm_rawDBSections, StringSplitOptions.None);
                                    atlasLootItems = splittedText[1];
                                }
                                var instancesData = atlasLootItems.Split(';');
                                foreach (var instanceData in instancesData)
                                {
                                    var bossNameAndData = instanceData.Split(new string[] { " = {", "}," }, StringSplitOptions.None);

                                    var bossName = bossNameAndData[0].Split(' ', '\t').Last();

                                    WowBoss wowBoss;
                                    if (_WowBossConvert.TryGetValue(bossName, out wowBoss) == false)
                                    {
                                        if (bossName.StartsWith("PVP"))
                                        {
                                            if (Enum.TryParse(bossName.Replace("PVP", "PVPEpic"), out wowBoss) == false)
                                            {
                                                continue;
                                            }
                                        }
                                        else
                                        {
                                            //Not interesting, move on
                                            continue;
                                        }
                                    }
                                    try
                                    {
                                        for (int i = 1; i < bossNameAndData.Length - 1; ++i)
                                        {
                                            var data = bossNameAndData[i].Split('{', ',', '}');
                                            //data[0] == tabtabspaces (example: \t\t)
                                            //data[1] == itemID (example:  28329)
                                            //data[2] == texture (example: "INV_Bracer_09")
                                            //data[3 to n] == quality and name (example: "=q4=Netherwind Bindings")
                                            //data[n+1 to m] == crap (example: "=q1=#m1# =ds=#c3#")
                                            //data[m+1] == droprate (example: "11.31%")

                                            int itemID = 0;
                                            if (int.TryParse(data[1], out itemID) == false)
                                            {
                                                itemID = 0;
                                            }

                                            if (itemID != 0)
                                            {
                                                int    u              = 2;
                                                string texture        = RebuildSplittedSection(data, ref u, '\"', ",");
                                                string qualityAndName = RebuildSplittedSection(data, ref u, '\"', ",");
                                                string extraInfo      = RebuildSplittedSection(data, ref u, '\"', ",");
                                                //if (bossName.StartsWith("T3"))
                                                //{
                                                //    //string[] extraInfoSplit = extraInfo.Split(new string[]{".."}, StringSplitOptions.None);
                                                //    //foreach (string currInfo in extraInfoSplit)
                                                //    //{
                                                //    //    try
                                                //    //    {
                                                //    //        if (currInfo.StartsWith("AtlasLootBossNames[\"Naxxramas\"]["))
                                                //    //        {
                                                //    //            string bossIndex = currInfo.Split(new string[] { "[", "]" }, StringSplitOptions.RemoveEmptyEntries)[2];

                                                //    //        }
                                                //    //    }
                                                //    //    catch (Exception)
                                                //    //    {

                                                //    //        throw;
                                                //    //    }
                                                //    //}
                                                //}
                                                string dropRateStr = RebuildSplittedSection(data, ref u, '\"', ",");
                                                float  dropRate;
                                                if (float.TryParse(dropRateStr.Replace("%", "").Replace('.', ','), out dropRate) == false)
                                                {
                                                    dropRate = 0.0f;
                                                }

                                                if (m_Database.ContainsKey(itemID) == false)
                                                {
                                                    m_Database.Add(itemID, new List <ItemDropDataItem>(2));
                                                }
                                                m_Database[itemID].Add(new ItemDropDataItem(wowBoss, dropRate));

                                                WowBoss extraWowBoss = wowBoss;
                                                if (bossName.StartsWith("T3"))
                                                {
                                                    if (texture.StartsWith("INV_Crown") || texture.StartsWith("INV_Helmet"))
                                                    {
                                                        extraWowBoss = WowBoss.Thaddius;
                                                    }
                                                    else if (texture.StartsWith("INV_Gauntlets"))
                                                    {
                                                        extraWowBoss = WowBoss.Maexxna;
                                                    }
                                                    else if (texture.StartsWith("INV_Pants"))
                                                    {
                                                        extraWowBoss = WowBoss.Loatheb;
                                                    }
                                                    else if (texture.StartsWith("INV_Chest"))
                                                    {
                                                        extraWowBoss = WowBoss.The_Four_Horsemen;
                                                    }
                                                    else if (texture.StartsWith("INV_Jewelry_Ring"))
                                                    {
                                                        extraWowBoss = WowBoss.Kel_Thuzad;
                                                    }
                                                }
                                                else if (bossName.StartsWith("AQ40"))
                                                {
                                                    if (texture.StartsWith("INV_Helmet"))
                                                    {
                                                        extraWowBoss = WowBoss.The_Twin_Emperors;
                                                    }
                                                    else if (texture.StartsWith("INV_Chest"))
                                                    {
                                                        extraWowBoss = WowBoss.C_Thun;
                                                    }
                                                    else if (texture.StartsWith("INV_Pants"))
                                                    {
                                                        extraWowBoss = WowBoss.Ouro;
                                                    }
                                                }

                                                if (extraWowBoss != wowBoss)
                                                {
                                                    m_Database[itemID].Add(new ItemDropDataItem(extraWowBoss, 0.0f));
                                                }
                                            }
                                            else
                                            {
                                                int    u       = 2;
                                                string texture = RebuildSplittedSection(data, ref u, '\"', ",");
                                                if (texture != "")
                                                {
                                                    if (bossName.StartsWith("PVP"))
                                                    {
                                                        string qualityAndName = RebuildSplittedSection(data, ref u, '\"', ",");
                                                        string crap           = RebuildSplittedSection(data, ref u, '\"', ",");

                                                        if (crap == "=q5=#pvps1#")
                                                        {
                                                            WowBoss newWowBoss;
                                                            if (Enum.TryParse(bossName.Replace("PVP", "PVPEpic"), out newWowBoss) == true)
                                                            {
                                                                wowBoss = newWowBoss;
                                                            }
                                                        }
                                                        else if (crap == "=q5=#pvps2#")
                                                        {
                                                            WowBoss newWowBoss;
                                                            if (Enum.TryParse(bossName.Replace("PVP", "PVPRare"), out newWowBoss) == true)
                                                            {
                                                                wowBoss = newWowBoss;
                                                            }
                                                        }
                                                    }
                                                }
                                            }
                                        }
                                    }
                                    catch (Exception ex)
                                    {
                                        Logger.LogException(ex);
                                    }
                                }
                            }
                            catch (Exception ex)
                            {
                                Logger.LogException(ex);
                            }
                        }
                    }
                    Utility.SaveSerialize(_RootPath + "\\ItemDropDatabase.dat", m_Database);
                }
            }
            catch (Exception ex)
            {
                Logger.LogException(ex);
            }
            if (m_Database == null)
            {
                m_Database = new Dictionary <int, List <ItemDropDataItem> >();
            }
        }
示例#3
0
 public ItemDropDataItem(WowBoss _Boss, float _DropChance)
 {
     m_Boss       = _Boss;
     m_DropChance = _DropChance;
 }