public override LootDrop CreateLootDrop() { LootDrop drop = new LootDrop(_connection, _queryConfig); int id = 0; var results = QueryHelper.TryRunQuery(_connection, "SELECT Max(id) as id FROM lootdrop;"); if (results.Count > 0) { id = Int32.Parse(results.ElementAt(0)["id"].ToString()) + 1; } drop.Id = id; return drop; }
public void RemoveLootDrop(LootDrop lootdrop) { if (CreatedObj) { if (!NeedsInserted.Contains(lootdrop)) { NeedsDeleted.Add(lootdrop); } else { NeedsInserted.Remove(lootdrop); } } _lootDrops.Remove(lootdrop); }
public void Lookup(int id) { _id = id; string sql = String.Format(SelectString, SelectArgValues); var results = Database.QueryHelper.TryRunQuery(_connection, sql); foreach (var row in results) { var lootdrop = new LootDrop(_connection, _queryConfig); lootdrop.SetProperties(Queries, row); lootdrop.Lookup(lootdrop.Id); //hack job if (row.ContainsKey("mincash")) { _minCash = Int32.Parse(row["mincash"].ToString()); } if (row.ContainsKey("maxcash")) { _minCash = Int32.Parse(row["maxcash"].ToString()); } if (row.ContainsKey("name")) { _name = row["name"].ToString(); } lootdrop.UnlockObject(); AddLootDrop(lootdrop); lootdrop.Created(); } Created(); }
public void AddLootDrop(LootDrop lootdrop) { if (LootDrops.Count(x => x.Id == lootdrop.Id) > 0) return; lootdrop.LootTableId = Id; if (CreatedObj) { NeedsInserted.Add(lootdrop); } _lootDrops.Add(lootdrop); }