Exemple #1
0
        /// <summary>
        /// Creates an Object of Type Armor, loaded from table items
        /// </summary>
        /// <param name="database">Object of type Database</param>
        /// <param name="id">id of item</param>
        public Armor(Database database, int id)
        {
            List<string> fields = new List<string>();
            fields.Add("name");
            fields.Add("mod_accuracy");
            fields.Add("mod_attack");
            fields.Add("mod_defense");
            fields.Add("mod_range_min");
            fields.Add("mod_range_max");
            fields.Add("mod_move");
            fields.Add("mod_health");
            fields.Add("points");

            List<Condition> cs = new List<Condition>();
            cs.Add(new Condition("id", ConditionTypes.Is, id.ToString()));
            cs.Add(new Condition("item_type", ConditionTypes.Is, "armor"));

            Dictionary<int, Dictionary<string, string>> r = database.Select("items", cs, fields);

            this.id = id;
            name = r[0]["name"];
            mod_accuracy = Convert.ToInt32(r[0]["mod_accuracy"]);
            mod_attack = Convert.ToInt32(r[0]["mod_attack"]);
            mod_defense = Convert.ToInt32(r[0]["mod_defense"]);
            mod_range_min = Convert.ToInt32(r[0]["mod_range_min"]);
            mod_range_max = Convert.ToInt32(r[0]["mod_range_max"]);
            mod_move = Convert.ToInt32(r[0]["mod_move"]);
            points = Convert.ToInt32(r[0]["points"]);
            mod_health = Convert.ToInt32(r[0]["mod_health"]);
        }
Exemple #2
0
        /// <summary>
        /// Get CellType From Database
        /// </summary>
        /// <param name="type">Type of Field</param>
        /// <param name="database">Object of Database</param>
        public CellType(string type, Database database)
        {
            List<string> fields = new List<string>();
            fields.Add("name");
            fields.Add("image_id"); //type: longblob
            fields.Add("mod_attack");
            fields.Add("mod_defense");
            fields.Add("mod_range");
            fields.Add("mod_move");

            List<Condition> cs = new List<Condition>();
            cs.Add(new Condition("cell_type", ConditionTypes.Is, type));

            Dictionary<int,  Dictionary<string,string>> r = database.Select("cell_types",cs, fields);

            name = r[0]["name"];
            image = database.LoadImage(Convert.ToInt32(r[0]["image_id"]));
            mod_attack = Convert.ToInt32(r[0]["mod_attack"]);
            mod_defense = Convert.ToInt32(r[0]["mod_defense"]);
            mod_range = Convert.ToInt32(r[0]["mod_range"]);
            mod_move = Convert.ToInt32(r[0]["mod_move"]);
        }