예제 #1
0
        static public void processSpellset(CharConverter app, String call, ref XmlNode inChar, ref XmlNode outChar, ref XmlNode targetNode)
        {
            foreach (XmlNode spellset in targetNode.ChildNodes)
            {
                if (spellset.SelectSingleNode("levels") == null)
                {
                    continue;
                }
                foreach (XmlNode level in spellset.SelectSingleNode("levels").ChildNodes)
                {
                    foreach (XmlNode spell in level.SelectSingleNode("spells").ChildNodes)
                    {
                        String   value  = app.ValueOf(spell, "school");
                        String[] school = value.Split(':');
                        var      sb     = new StringBuilder();
                        sb.Append(school[0]);
                        var innerbra = new StringBuilder();
                        for (int i = 1; i < school.Length; i++)
                        {
                            value = school[i];
                            if (!String.IsNullOrEmpty(value))
                            {
                                innerbra.Append(value);
                            }
                            if (i + 1 < school.Length &&
                                !String.IsNullOrEmpty(school[i + 1]))
                            {
                                innerbra.Append(",");
                            }
                        }
                        if (!String.IsNullOrEmpty(innerbra.ToString()))
                        {
                            sb.Append(" [").Append(innerbra.ToString()).Append("]");
                        }
                        app.Set(spell, "school", sb.ToString());
                    }
                }
            }

            XmlNodeList nodelist = targetNode.ChildNodes;

            for (int i = nodelist.Count - 1; i >= 0; i--)
            {
                if (nodelist[i].ChildNodes.Count <= 1)
                {
                    targetNode.RemoveChild(nodelist[i]);
                }
            }
        }
예제 #2
0
        static public void processSpecialabilitylist(CharConverter app, String call, ref XmlNode inChar, ref XmlNode outChar, ref XmlNode targetNode)
        {
            String value;
            var    ApiAtributes     = app.ParseApiAttributes(call);
            String characterClasses = "classes";
            String characterName    = "name";

            if (ApiAtributes.ContainsKey("classes"))
            {
                characterClasses = ApiAtributes["classes"];
            }
            if (ApiAtributes.ContainsKey("name"))
            {
                characterName = ApiAtributes["name"];
            }

            foreach (XmlNode classnode in outChar.SelectSingleNode(characterClasses).ChildNodes)
            {
                value = app.ValueOf(classnode, "name");
                //Checks for speciality
                if (!value.Equals(ParseClassName(value)))
                {
                    app.Set(classnode, characterName, ParseClassName(value));
                    XmlNode spabilitylist = targetNode;
                    XmlNode specialty     = outChar.OwnerDocument.CreateElement(CharConverter.CreateId(spabilitylist));
                    String  specialtyname = value;

                    value = "Specialty: " + value;
                    specialty.AppendChild(CharConverter.CreateElement(outChar.OwnerDocument, "value", "string", value));

                    value = "The specialty for the " + ParseClassName(specialtyname) + "class is " + specialtyname + ".";
                    specialty.AppendChild(CharConverter.CreateElement(outChar.OwnerDocument, "description", "string", value));

                    if (spabilitylist.ChildNodes.Count > 0)
                    {
                        spabilitylist.InsertBefore(specialty, spabilitylist.ChildNodes[0]);
                    }
                    else
                    {
                        spabilitylist.AppendChild(specialty);
                    }
                }
            }
        }
예제 #3
0
        static public void processSkilllist(CharConverter app, String call, ref XmlNode inChar, ref XmlNode outChar, ref XmlNode targetNode)
        {
            String value;

            foreach (XmlNode skill in targetNode.ChildNodes)
            {
                String label = app.ValueOf(skill, "label");
                if (label.Contains("(") &&
                    label.Contains(")") &&
                    (label.Contains("Knowledge") ||
                     label.Contains("Perform") ||
                     label.Contains("Profession") ||
                     label.Contains("Craft")))
                {
                    app.Set(skill, "label", label.Split('(')[0]);
                    value = label.Split('(')[1].Split(')')[0];
                    skill.AppendChild(CharConverter.CreateElement(outChar.OwnerDocument, "sublabel", "string", value));
                }
            }
        }