Пример #1
0
 public void RemoveModifier(StatAddRule modifier)
 {
     if (this.additions.Remove(modifier))
     {
         modifier.PropertyChanged -= this.onModifierChanged;
         Notify("Value");
     }
 }
Пример #2
0
 public void AddModifier(StatAddRule modifier)
 {
     if (this.additions.Add(modifier))
     {
         modifier.PropertyChanged += this.onModifierChanged;
         Notify("Value");
     }
 }
Пример #3
0
 public WearingStatAdd(RuleElement element, WearingExpression predicate, StatAddRule rule)
     : base(element, rule)
 {
     this.predicate = predicate;
     this.predicate.PropertyChanged += PredicateValueChanged;
 }
Пример #4
0
 public NotWearingStatAdd(RuleElement element, WearingExpression predicate, StatAddRule rule)
     : base(element, predicate, rule)
 {
 }
Пример #5
0
 protected DelegatingStatAdd(RuleElement element, StatAddRule rule)
     : base(element)
 {
     this.baseRule = rule;
     this.baseRule.PropertyChanged += BaseRulePropertyChanged;
 }
Пример #6
0
 public ConditionalStatAdd(RuleElement element, string condition, StatAddRule rule)
     : base(element, rule)
 {
     this.condition = condition;
 }
Пример #7
0
 public WearingStatAdd(RuleElement element, WearingExpression predicate, StatAddRule rule)
     : base(element, rule)
 {
     this.predicate = predicate;
 }
Пример #8
0
 protected DelegatingStatAdd(RuleElement element, StatAddRule rule)
     : base(element)
 {
     this.baseRule = rule;
 }
Пример #9
0
        public RuleElement(XElement element)
        {
            this.xml      = element;
            this.fullname = Identifier.Get(element.Attribute(XNames.Name).Value + " " + element.Attribute(XNames.Type).Value);
            this.name     = Identifier.Get(element.Attribute(XNames.Name).Value);
            this.type     = Identifier.Get(element.Attribute(XNames.Type).Value);
            this.id       = Identifier.Get(element.Attribute(XNames.InternalID).Value);

            XAttribute attribute = element.Attribute(XNames.Source);

            if (attribute != null)
            {
                this.source = element.Attribute(XNames.Source).Value;
            }

            string description = "";

            foreach (XNode node in element.Nodes())
            {
                if (node.NodeType == System.Xml.XmlNodeType.Element)
                {
                    var subElement = (XElement)node;
                    if (subElement.Name == XNames.Category)
                    {
                        string[] split = subElement.Value.Trim().Split(',');
                        this.category = new Identifier[split.Length];
                        for (int i = 0; i < split.Length; i++)
                        {
                            category[i] = Identifier.Get(split[i]);
                        }
                    }
                    else if (subElement.Name == XNames.Specific)
                    {
                        this.specifics[subElement.Attribute(XNames.Name).Value] = subElement.Value;
                    }
                    else if (subElement.Name == XNames.Flavor)
                    {
                        this.flavor = subElement.Value;
                    }
                    else if (subElement.Name == XNames.PrintPrereqs)
                    {
                        this.printPrereqs = subElement.Value;
                    }
                    else if (subElement.Name == XNames.Prereqs)
                    {
                        this.preReqs = subElement.Value.Trim().Split(',');
                    }
                    else if (subElement.Name == XNames.Rules)
                    {
                        foreach (XElement ruleElement in subElement.Elements())
                        {
                            if (ruleElement.Name == XNames.Grant)
                            {
                                this.rules.Add(GrantRule.New(this, ruleElement));
                            }
                            else if (ruleElement.Name == XNames.TextString)
                            {
                                this.rules.Add(TextStringRule.New(this, ruleElement));
                            }
                            else if (ruleElement.Name == XNames.StatAdd)
                            {
                                this.rules.Add(StatAddRule.New(this, ruleElement));
                            }
                            else if (ruleElement.Name == XNames.Select)
                            {
                                this.rules.Add(SelectRule.New(this, ruleElement));
                            }
                            else if (ruleElement.Name == XNames.Replace)
                            {
                                this.rules.Add(ReplaceRule.New(this, ruleElement));
                            }
                            else if (ruleElement.Name == XNames.Modify)
                            {
                                this.rules.Add(ModifyRule.New(this, ruleElement));
                            }
                            else if (ruleElement.Name == XNames.Drop)
                            {
                                this.rules.Add(DropRule.New(this, ruleElement));
                            }
                            else if (ruleElement.Name == XNames.Suggest)
                            {
                                this.rules.Add(SuggestRule.New(this, ruleElement));
                            }
                            else if (ruleElement.Name == XNames.StatAlias)
                            {
                                this.rules.Add(StatAliasRule.New(this, ruleElement));
                            }
                            else
                            {
                                throw new NotSupportedException("Unsupported rule name: " + ruleElement.Name.ToString());
                            }
                        }
                    }
                    else
                    {
                        throw new NotSupportedException("Unsupported element name: " + subElement.Name.ToString());
                    }
                }
                else if (node.NodeType == System.Xml.XmlNodeType.Text)
                {
                    description += node.ToString(SaveOptions.DisableFormatting);
                }
            }

            this.description = description.Trim();
        }
Пример #10
0
 public NotWearingStatAdd(RuleElement element, WearingExpression predicate, StatAddRule rule)
     : base(element, predicate, rule)
 {
 }
Пример #11
0
 public WearingStatAdd(RuleElement element, WearingExpression predicate, StatAddRule rule)
     : base(element, rule)
 {
     this.predicate = predicate;
     this.predicate.PropertyChanged += PredicateValueChanged;
 }
Пример #12
0
 public ConditionalStatAdd(RuleElement element, string condition, StatAddRule rule)
     : base(element, rule)
 {
     this.condition = condition;
 }
Пример #13
0
 protected DelegatingStatAdd(RuleElement element, StatAddRule rule)
     : base(element)
 {
     this.baseRule = rule;
     this.baseRule.PropertyChanged += BaseRulePropertyChanged;
 }
Пример #14
0
 public WearingStatAdd(RuleElement element, WearingExpression predicate, StatAddRule rule)
     : base(element, rule)
 {
     this.predicate = predicate;
 }
Пример #15
0
 protected DelegatingStatAdd(RuleElement element, StatAddRule rule)
     : base(element)
 {
     this.baseRule = rule;
 }