GetStreamName() public static method

public static GetStreamName ( UInt32 TypeId, UInt32 subTypeId ) : string
TypeId System.UInt32
subTypeId System.UInt32
return string
Exemplo n.º 1
0
        public static void ParseVendor(UInt32 entry, UInt32 typeId, UInt32 subTypeId, List <String> content)
        {
            StringBuilder strBuilder = new StringBuilder();

            strBuilder.AppendLine(String.Format("-- Parsing {0} vendor data for entry {1}", Defines.GetStreamName(typeId, subTypeId), entry));
            strBuilder.AppendLine(String.Format("DELETE FROM `{0}` WHERE entry = {1};", Defines.GetDBName(typeId, subTypeId), entry));

            WowheadSerializer serializer = new WowheadSerializer(content, typeId, subTypeId);

            foreach (Dictionary <String, Object> objectInto in serializer.Objects)
            {
                try
                {
                    WowheadObject wowheadObject = new WowheadObject(objectInto);

                    UInt32 id           = wowheadObject.GetId();
                    String name         = wowheadObject.GetFixedName();
                    UInt32 extendedCost = ExtendedCosts.GetExtendedCost(wowheadObject.GetCurrencyCost(), wowheadObject.GetItemCost(), 0);

                    // Needed (NULL cost ?)
                    if (extendedCost == 2)
                    {
                        extendedCost = 0;
                    }

                    String str = String.Format("INSERT INTO `{0}` VALUES ( '{1}', '{2}', '{3}', '{4}', '{5}', '{6}', '{7}'); -- {8}",
                                               Defines.GetDBName(typeId, subTypeId), entry, 0, id, 0, 0, extendedCost, 1, name);
                    strBuilder.AppendLine(str);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            strBuilder.AppendLine(String.Format("-- Parsed {0} data for entry {1}", Defines.GetStreamName(typeId, subTypeId), entry));
            strBuilder.AppendLine("");
            WriteSQL(typeId, entry, strBuilder.ToString());

            Console.WriteLine("{0}% - Parsed {1} data for entry {2}", Math.Round(++dataDone / (float)commandList.Count * 100, 2), Defines.GetStreamName(typeId, subTypeId), entry);
        }
Exemplo n.º 2
0
        public static void DroppedByParser(uint entry, uint typeId, uint subTypeId, List <String> content)
        {
            StringBuilder strBuilder = new StringBuilder();

            strBuilder.AppendLine(String.Format("-- Parsing {0} loot for entry {1}", Defines.GetStreamName(typeId, subTypeId), entry));
            strBuilder.AppendLine(String.Format("DELETE FROM `{0}` WHERE item = {1};", Defines.GetDBName(typeId, subTypeId), entry));

            WowheadSerializer serializer = new WowheadSerializer(content, typeId, subTypeId);

            foreach (Dictionary <String, Object> objectInto in serializer.Objects)
            {
                try
                {
                    WowheadObject wowheadObject = new WowheadObject(objectInto);

                    UInt32 lootId   = wowheadObject.GetId();
                    String name     = wowheadObject.GetName();
                    Int32  maxcount = 1; // NYI
                    Int32  mincount = 1; // NYI
                    Double pct      = (wowheadObject.GetCount() / (Double)wowheadObject.GetOutOf()) * 100.0f;
                    pct = Math.Round(pct, 3);
                    String stringPct = pct.ToString().Replace(",", "."); // needs to be changed otherwise SQL errors

                    String str = String.Format("INSERT INTO `{0}` VALUES ( '{1}', '{2}', '{3}', '{4}', '{5}', '{6}' , '{7}'); -- {8}",
                                               Defines.GetDBName(typeId, subTypeId), lootId, entry, stringPct, 1, 0, mincount, maxcount, name);
                    strBuilder.AppendLine(str);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            strBuilder.AppendLine(String.Format("-- Parsed {0} loot for entry {1}", Defines.GetStreamName(typeId, subTypeId), entry));
            strBuilder.AppendLine("");
            WriteSQL(typeId, entry, strBuilder.ToString());

            Console.WriteLine("{0}% - Parsed {1} data for entry {2}", Math.Round(++dataDone / (Double)commandList.Count * 100, 2), Defines.GetStreamName(typeId, subTypeId), entry);
        }
Exemplo n.º 3
0
        public static void LootParser(uint entry, uint typeId, uint subTypeId, List <String> content)
        {
            StringBuilder strBuilder = new StringBuilder();

            strBuilder.AppendLine(String.Format("-- Parsing {0} loot for entry {1}", Defines.GetStreamName(typeId, subTypeId), entry));
            strBuilder.AppendLine(String.Format("DELETE FROM `{0}` WHERE entry = {1};", Defines.GetDBName(typeId, subTypeId), entry));

            WowheadSerializer serializer = new WowheadSerializer(content, typeId, subTypeId);

            foreach (Dictionary <String, Object> objectInto in serializer.Objects)
            {
                try
                {
                    WowheadObject wowheadObject = new WowheadObject(objectInto);

                    UInt32 lootId   = wowheadObject.GetId();
                    String name     = wowheadObject.GetFixedName();
                    UInt32 mincount = wowheadObject.GetStackArray()[0];
                    UInt32 maxcount = wowheadObject.GetStackArray()[1];
                    Double pct      = (wowheadObject.GetCount() / (Double)serializer.TotalCount) * 100.0f;
                    pct = Math.Round(pct, 3);
                    String stringPct = pct.ToString().Replace(",", "."); // needs to be changed otherwise SQL errors

                    Int32 lootmode = 0;
                    // Fishing lootmode - always 1
                    if (typeId == 0 && subTypeId == 0)
                    {
                        lootmode = 1;
                    }

                    // - infront of quest items
                    Int32 questId = wowheadObject.GetQuestId();

                    String str = String.Format("INSERT INTO `{0}` VALUES ( '{1}', '{2}', '{3}', '{4}', '{5}', '{6}' , '{7}'); -- {8}",
                                               Defines.GetDBName(typeId, subTypeId), entry, questId, stringPct, 1, lootmode, mincount, maxcount, name);
                    strBuilder.AppendLine(str);
                }
                catch (Exception e)
                {
                    Console.WriteLine(e.Message);
                }
            }

            // We need to parse aditional data
            // Gameobjects
            if (typeId == 1)
            {
                strBuilder.AppendLine(String.Format("UPDATE `gameobject_template` SET data1 = {0} WHERE entry = {0};", entry));
            }
            // Item Contains
            // Disenchanging
            foreach (String s in content)
            {
                if (Defines.StringContains(s, "[tooltip=tooltip_reqenchanting]").Success)
                {
                    if (typeId == 2 && subTypeId == 3)
                    {
                        strBuilder.AppendLine(String.Format("UPDATE `item_template` SET DisenchantID = '{0}', RequiredDisenchantSkill = '{1}' WHERE entry = '{0}';", entry, /*Defines.StringContains(line, "[tooltip=tooltip_reqenchanting]").Success ? */ uint.Parse(Defines.GetStringBetweenTwoOthers(s, "[tooltip=tooltip_reqenchanting]", "[/tooltip]")) /* : 1)*/));
                    }
                }
            }

            strBuilder.AppendLine(String.Format("-- Parsed {0} loot for entry {1}", Defines.GetStreamName(typeId, subTypeId), entry));
            strBuilder.AppendLine("");
            WriteSQL(typeId, entry, strBuilder.ToString());

            Console.WriteLine("{0}% - Parsed {1} loot for entry {2}", Math.Round(++dataDone / (float)commandList.Count * 100, 2), Defines.GetStreamName(typeId, subTypeId), entry);
        }
Exemplo n.º 4
0
        public static void ParseOutdatedQuests(uint entry, uint typeId, uint subTypeId, List <string> content)
        {
            StringBuilder strBuilder = new StringBuilder();

            foreach (string line in content)
            {
                Match match = Defines.GetDataRegex(typeId, subTypeId).Match(line);
                if (match.Success)
                {
                    strBuilder.AppendLine(string.Format("UPDATE `{0}` SET minLvl = -1, maxLvl = -1 WHERE entry = {1};", Defines.GetDBName(typeId, subTypeId), entry));
                }
            }
            WriteSQL(typeId, entry, strBuilder.ToString());
            Console.WriteLine("{0}% - Parsed {1} data for entry {2}", Math.Round(++dataDone / (float)commandList.Count * 100, 2), Defines.GetStreamName(typeId, subTypeId), entry);
        }