// create an object from a template public clsObject(clsDatabase db, int x,int y, int z, clsTemplate template): base(db) { this.x = x; this.y = y; this.z = z; this.type = template.type; this.name = template.name; // this should be the attribute name not the template name this.image = template.image; this.weight = template.weight; this.stackable = template.stackable; this.blocking = template.blocking; this.save(); // loop through template attibutes and use them to create object foreach (clsTemplateAttribute ta in template.templateAttributes) { // copy paste right now but could have random numbers, names etc.... clsAttribute a = new clsAttribute(_db); a.objectId = this.id; a.name = ta.name; a.value = ta.value; a.save(); } }
public clsBase(clsDatabase db, MySqlDataReader dr) { this.populate(dr); }
public clsBase(clsDatabase db, int id) { _db = db; this.load(id); }
public clsBase(clsDatabase db) { _db = db; }
public clsTemplate(clsDatabase db, string name): base(db) { this.load("SELECT * FROM " + this.tableName + "s WHERE name = '" + name + "'"); }
public clsTemplate(clsDatabase db, MySqlDataReader dr) : base(db, dr) { }
public clsTemplate(clsDatabase db, int id) : base(db, id) { }
public clsTemplate(clsDatabase db) : base(db) { }
public clsAttribute(clsDatabase db, MySqlDataReader dr) : base(db, dr) { }
public clsAttribute(clsDatabase db, int id) : base(db, id) { }
public clsAttribute(clsDatabase db) : base(db) { }
public clsWorld(string dbConString) { this.db = new clsDatabase(dbConString); this.map = new clsMap(this.db); }
private Random r = new Random(); // seed the random public clsMap(clsDatabase db) { _db = db; }
public clsObject(clsDatabase db, MySqlDataReader dr) : base(db, dr) { }
public clsObject(clsDatabase db, int id) : base(db, id) { }
public clsObject(clsDatabase db) : base(db) { }