示例#1
0
        public static string GetSpellWords(SpellComponentsTable comps, List <uint> formula)
        {
            string firstSpellWord  = "";
            string secondSpellWord = "";
            string thirdSpellWord  = "";

            if (formula == null)
            {
                return("");
            }

            // Locate the herb component in the Spell formula
            for (int i = 0; i < formula.Count; i++)
            {
                if (comps.SpellComponents[formula[i]].Type == (uint)Type.Herb)
                {
                    firstSpellWord = comps.SpellComponents[formula[i]].Text;
                }
            }

            // Locate the powder component in the Spell formula
            for (int i = 0; i < formula.Count; i++)
            {
                if (comps.SpellComponents[formula[i]].Type == (uint)Type.Powder)
                {
                    secondSpellWord = comps.SpellComponents[formula[i]].Text;
                }
            }

            // Locate the potion component in the Spell formula
            for (int i = 0; i < formula.Count; i++)
            {
                if (comps.SpellComponents[formula[i]].Type == (uint)Type.Potion)
                {
                    thirdSpellWord = comps.SpellComponents[formula[i]].Text;
                }
            }

            // We need to make sure our second spell word, if any, is capitalized
            // Some spell words have no "secondSpellWord", so we're basically making sure the third word is capitalized.
            string secondSpellWordSet = (secondSpellWord + thirdSpellWord.ToLower());

            if (secondSpellWordSet != "")
            {
                string firstLetter = secondSpellWordSet.Substring(0, 1).ToUpper();
                secondSpellWordSet = firstLetter + secondSpellWordSet.Substring(1);
            }

            string result = $"{firstSpellWord} {secondSpellWordSet}";

            return(result.Trim());
        }
示例#2
0
        public static SpellComponentsTable ReadFromDat()
        {
            // Check the FileCache so we don't need to hit the FileSystem repeatedly
            if (DatManager.PortalDat.FileCache.ContainsKey(0x0E00000F))
            {
                return((SpellComponentsTable)DatManager.PortalDat.FileCache[0x0E00000F]);
            }
            else
            {
                // Create the datReader for the proper file
                DatReader            datReader = DatManager.PortalDat.GetReaderForFile(0x0E00000F);
                SpellComponentsTable comps     = new SpellComponentsTable();

                comps.FileId = datReader.ReadUInt32();
                uint numComps = datReader.ReadUInt16(); // Should be 163 or 0xA3
                datReader.AlignBoundary();
                // loop through the entire file...
                for (uint i = 0; i < numComps; i++)
                {
                    SpellComponentBase newComp = new SpellComponentBase();
                    uint compId = datReader.ReadUInt32();
                    newComp.Name = datReader.ReadObfuscatedString();
                    datReader.AlignBoundary();
                    newComp.Category = datReader.ReadUInt32();
                    newComp.Icon     = datReader.ReadUInt32();
                    newComp.Type     = datReader.ReadUInt32();
                    newComp.Gesture  = datReader.ReadUInt32();
                    newComp.Time     = datReader.ReadSingle();
                    newComp.Text     = datReader.ReadObfuscatedString();
                    datReader.AlignBoundary();
                    newComp.CDM = datReader.ReadSingle();
                    comps.SpellComponents.Add(compId, newComp);
                }

                DatManager.PortalDat.FileCache[0x0E00000F] = comps;
                return(comps);
            }
        }
示例#3
0
        public static string GetSpellWords(SpellComponentsTable comps, List <uint> formula)
        {
            string firstSpellWord  = null;
            string secondSpellWord = null;
            string thirdSpellWord  = null;

            // Locate the herb component in the Spell formula
            for (int i = 0; i < formula.Count; i++)
            {
                if (comps.SpellComponents[formula[i]].Type == (uint)Type.Herb)
                {
                    firstSpellWord = comps.SpellComponents[formula[i]].Text;
                }
            }

            // Locate the powder component in the Spell formula
            for (int i = 0; i < formula.Count; i++)
            {
                if (comps.SpellComponents[formula[i]].Type == (uint)Type.Powder)
                {
                    secondSpellWord = comps.SpellComponents[formula[i]].Text;
                }
            }

            // Locate the potion component in the Spell formula
            for (int i = 0; i < formula.Count; i++)
            {
                if (comps.SpellComponents[formula[i]].Type == (uint)Type.Potion)
                {
                    thirdSpellWord = comps.SpellComponents[formula[i]].Text;
                }
            }

            string result = $"{firstSpellWord} {secondSpellWord}{thirdSpellWord.ToLower()}";

            return(result);
        }