public Possession(OGLContext context, string Base, int count)
 {
     Context         = context;
     Name            = "";
     Description     = "";
     Count           = count * Context.GetItem(Base, null).StackSize;
     BaseItem        = Base;
     Equipped        = EquipSlot.None;
     Attuned         = false;
     ChargesUsed     = 0;
     Hightlight      = false;
     MagicProperties = new List <string>();
     Weight          = -1;
 }
 public Possession(OGLContext context, string name, string text, int count, double weight = 0.0)
 {
     Context         = context;
     Name            = name;
     Description     = text;
     Count           = count;
     BaseItem        = "";
     Equipped        = EquipSlot.None;
     Attuned         = false;
     ChargesUsed     = 0;
     Weight          = weight;
     Hightlight      = false;
     MagicProperties = new List <string>();
 }
Example #3
0
 public RaceEditModel(Race cond, OGLContext context) : base(cond, context)
 {
     ShowImage = new Command(async() =>
     {
         await Navigation.PushAsync(new ImageEditor(Image, Model.ImageData, SaveImage, "Image"));
     });
     SaveImage = new Command(async(par) =>
     {
         MakeHistory();
         Model.ImageData = par as byte[];
         OnPropertyChanged("Image");
         await Navigation.PopAsync();
     });
 }
Example #4
0
        public SubClass GetSubClass(OGLContext context)
        {
            if (SubClassName == null || SubClassName == "")
            {
                return(null);
            }
            string source = null;

            if (GetClass(context) != null)
            {
                source = GetClass(context).Source;
            }
            return(context.GetSubClass(SubClassName, source));
        }
 public string ToString(Monster monster, OGLContext context)
 {
     if (Skill != null)
     {
         try
         {
             Skill s = context.GetSkill(Skill, monster.Source);
             if (s.Base != Ability.None)
             {
                 return(Skill + " " + (monster.getAbility(s.Base) / 2 - 5 + Bonus).ToString("+#;-#;+0") + (Text != null && Text != "" ? " (" + Text + ")" : ""));
             }
         }
         catch (Exception) { }
     }
     if (Ability != Ability.None)
     {
         return(Skill + " " + (monster.getAbility(Ability) / 2 - 5 + Bonus).ToString("+#;-#;+0") + (Text != null && Text != "" ? " (" + Text + ")" : ""));
     }
     return(ToString());
 }
Example #6
0
        public static void ImportConditions(this OGLContext context)
        {
            context.Conditions.Clear();
            context.ConditionsSimple.Clear();
            var files = SourceManager.EnumerateFiles(context, context.Config.Conditions_Directory, SearchOption.TopDirectoryOnly);

            foreach (var f in files)
            {
                try
                {
                    using (TextReader reader = new StreamReader(f.Key.FullName))
                    {
                        Condition s = (Condition)Condition.Serializer.Deserialize(reader);
                        s.Source = f.Value;
                        s.Register(context, f.Key.FullName);
                    }
                }
                catch (Exception e)
                {
                    ConfigManager.LogError("Error reading " + f.ToString(), e);
                }
            }
        }
Example #7
0
        public static void ImportSubClasses(this OGLContext context, bool applyKeywords = false)
        {
            context.SubClasses.Clear();
            context.SubClassesSimple.Clear();
            var files = SourceManager.EnumerateFiles(context, context.Config.SubClasses_Directory, SearchOption.TopDirectoryOnly);

            foreach (var f in files)
            {
                try
                {
                    using (TextReader reader = new StreamReader(f.Key.FullName))
                    {
                        SubClass s = (SubClass)SubClass.Serializer.Deserialize(reader);
                        s.Source = f.Value;
                        s.Register(context, f.Key.FullName, applyKeywords);
                    }
                }
                catch (Exception e)
                {
                    ConfigManager.LogError("Error reading " + f.ToString(), e);
                }
            }
        }