public static void GenerateTechs() { var db = new ZkDataContext(); db.StructureTypes.DeleteAllOnSubmit(db.StructureTypes.Where(x => x.Unlock != null)); db.SaveChanges(); foreach (var u in db.Unlocks.Where(x => x.UnlockType == UnlockTypes.Unit)) { var s = new StructureType() { BattleDeletesThis = false, Cost = u.XpCost / 2, MapIcon = "techlab.png", DisabledMapIcon = "techlab_dead.png", Name = u.Name, Description = string.Format("Access to {0} and increases influence gains", u.Name), TurnsToActivate = u.XpCost / 100, IsBuildable = true, IsIngameDestructible = true, IsBomberDestructible = true, Unlock = u, UpkeepEnergy = u.XpCost / 5, IngameUnitName = "pw_" + u.Code, }; db.StructureTypes.InsertOnSubmit(s); } db.SaveChanges(); }
public static MvcHtmlString PrintStructureType(this HtmlHelper helper, StructureType stype) { var url = Global.UrlHelper(); if (stype != null) return new MvcHtmlString(string.Format("<span nicetitle='$structuretype${0}'>{1}</span>", stype.StructureTypeID, stype.Name)); else return new MvcHtmlString(""); }