Example #1
0
 public Effect()
 {
     Description = new Description();
     Events = new CombatEvents();
     Properties = new PropertyNotificationObject();
     Properties.PropertyChanged += PropertyChanged;
     _runtime = Scripting.Instance.Runtime;
 }
Example #2
0
File: Item.cs Project: nate0001/AIR
        public Item()
        {
            _runtime = Scripting.Instance.Runtime;

            Description = new Description();
            Properties = new PropertyNotificationObject();
            Properties.PropertyChanged += PropertyChanged;
        }
Example #3
0
        public static void LoadFromSql(Description description, int id)
        {
            if (null == description)
                throw new NullReferenceException();

            string query =
                string.Format(
                    @"SELECT [description_table].[format] FROM [description_table] WHERE [description_table].[id] = {0}",
                    id);

            DataTable dataTable = Database.Instance.Query(query);

            if (0 == dataTable.Rows.Count)
                throw new IndexOutOfRangeException();

            DataRow dataRow = dataTable.Rows[0];

            description.DescriptionFormat = dataRow["format"].ToString();

            query = string.Format(
                @"SELECT [arguments].[arg]
                FROM [items]
                    INNER JOIN [description_table] ON [description_table].[id] = [items].[description_table_id]
                    INNER JOIN [description_table_entries]
                        ON [description_table].[id] = [description_table_entries].[description_table_id]
                    INNER JOIN [arguments]
                        ON [arguments].[id] = [description_table_entries].[args_id]
                WHERE [items].[description_table_id] = {0}",
                id);

            dataTable = Database.Instance.Query(query);

            foreach (DataRow arg in dataTable.Rows)
            {
                description.DescriptionArgs.Add(arg["arg"].ToString());
            }
        }