Ejemplo n.º 1
0
        static public void processProficiencyarmor(CharConverter app, String call, ref XmlNode inChar, ref XmlNode outChar, ref XmlNode targetNode)
        {
            var    ApiAtributes = app.ParseApiAttributes(call);
            String featlist     = ApiAtributes.ContainsKey("featlist") ? ApiAtributes["featlist"] : "featlist";

            XmlNode     node     = outChar.SelectSingleNode(featlist);
            XmlNodeList nodelist = node.ChildNodes;
            XmlNode     armorpro = targetNode;

            for (int i = nodelist.Count - 1; i >= 0; i--)
            {
                XmlNode feat   = nodelist[i];
                String  value  = app.ValueOf(feat, "value");
                XmlNode target = null;
                if (value.Contains("Armor Proficiency"))
                {
                    value  = value.Split(',')[1].Substring(1);
                    target = armorpro;
                }
                else if (value.Contains("Shield Proficiency"))
                {
                    String[] valuesplit = value.Split(' ');
                    var      shsb       = new StringBuilder();
                    foreach (String shvalue in valuesplit)
                    {
                        if (shvalue.Equals("Proficiency"))
                        {
                            break;
                        }

                        shsb.Append(shvalue);
                        shsb.Append(" ");
                    }
                    shsb.Remove(shsb.Length - 1, 1);
                    value  = shsb.ToString();
                    target = armorpro;

                    node.RemoveChild(node.ChildNodes[i]);
                }
                if (target != null)
                {
                    if (app.CheckForDuplicateValue(armorpro, value))
                    {
                        continue;
                    }

                    target.AppendChild(outChar.OwnerDocument.CreateElement(CharConverter.CreateId(target)));
                    target.LastChild.AppendChild(CharConverter.CreateElement(outChar.OwnerDocument, "value", "string", value));
                    value = app.ValueOf(feat, "description");
                    target.LastChild.AppendChild(CharConverter.CreateElement(outChar.OwnerDocument, "description", "string", value));
                }
            }
        }
Ejemplo n.º 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);
                    }
                }
            }
        }
Ejemplo n.º 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));
                }
            }
        }