private static void InsertFakeData(IRepository repository) { var buildingRecord = new BuildingRecord { Name = "10e avenue" }; repository.Building.Save(buildingRecord); var door5545 = new DoorRecord { BuildingID = buildingRecord.BuildingID, Address = "5545, 10e avenue, Montréal, H1Y 2G9" }; repository.Door.Save(door5545); var thomasMorel = new TenantRecord() { DoorID = door5545.DoorID, FirstName = "Thomas", LastName = "Morel" }; repository.Tenant.Save(thomasMorel); var tenantInteractionRecord = new TenantInteractionRecord() { AsOfDate = DateTime.Today, Comment = "Remise de son releve 31", TenantID = thomasMorel.TenantID }; repository.TenantInteraction.Save(tenantInteractionRecord); }
public void initialize(BattleBuildingRecord info, BattleConfiguration configuration) { _record = configuration.buildingRecords.GetByBuildingId(info.id, info.race); _battleRecord = info; setOwnerId(info.ownerId); transform.setFromPoint(info.position); units.setCount(_battleRecord.units); var unitsPerSecond = infoLevel.UnitsProduction; AddComponent <UnitRegenComponent>().setUnitsPerTick((unitsPerSecond / engine.configuration.ticksPerSecond)); switch (_record.Type) { case BuildingType.DEFENSE: AddComponent <BuildingAttackDefenseComponent>(); break; case BuildingType.MANNA: AddComponent <MannaRegenComponent>(); break; case BuildingType.PRODUCTION: break; } }
private static void BuildDB() { UserRecord u = new UserRecord(); u.Drop(); u.Create(); AllianceRecord a = new AllianceRecord(); a.Drop(); a.Create(); PlanetRecord p = new PlanetRecord(); p.Drop(); p.Create(); ReportRecord r = new ReportRecord(); r.Drop(); r.Create(); ResourceRecord res = new ResourceRecord(); res.Drop(); res.Create(); BuildingRecord b = new BuildingRecord(); b.Drop(); b.Create(); ResearchRecord re = new ResearchRecord(); re.Drop(); re.Create(); FleetRecord f = new FleetRecord(); f.Drop(); f.Create(); DefenceRecord d = new DefenceRecord(); d.Drop(); d.Create(); }
public AITurret(uint netId, AIUnitRecord record, MapObjectRecord mapObject, BuildingRecord buildingRecord, string suffix) : base(netId, record) { this.NetId = netId; this.MapObjectRecord = mapObject; this.Position = new Vector2(mapObject.Position.X, mapObject.Position.Y); this.Suffix = suffix; this.BuildingRecord = buildingRecord; }
protected void SpawnInhibitor(string name) { uint netId = BuildingProvider.BUILDING_NETID_X | CRC32.Compute(Encoding.ASCII.GetBytes(name)); Inhibitor inhibitor = new Inhibitor(netId, BuildingRecord.GetBuildingRecord(this.Game.Map.Id, name), Game.Map.Record.GetObject(name)); inhibitor.DefineGame(Game); Game.AddUnitToTeam(inhibitor, BuildingProvider.Instance.GetTeamId(name)); Game.Map.AddUnit(inhibitor); }
protected void SpawnNexus(string name) { uint netId = BuildingProvider.BUILDING_NETID_X | CRC32.Compute(Encoding.ASCII.GetBytes(name)); Nexus nexus = new Nexus(netId, BuildingRecord.GetBuildingRecord(this.Game.Map.Id, name), Game.Map.Record.GetObject(name)); nexus.DefineGame(Game); Game.AddUnitToTeam(nexus, BuildingProvider.Instance.GetTeamId(name)); Game.Map.AddUnit(nexus); }
public static bool ParseReport(string html, ReportRecord report) { try { if (html.Contains("Nie znaleziono")) { report.Status = "Brak"; report.LastUpdate = DateTime.Now; } else { report.Status = "Jest"; //report.LastUpdate = ParseDate(html); } ResourceRecord resource = new ResourceRecord { Id = report.Id }; BuildingRecord building = new BuildingRecord { Id = report.Id }; ResearchRecord research = new ResearchRecord { Id = report.Id }; DefenceRecord defence = new DefenceRecord { Id = report.Id }; FleetRecord fleet = new FleetRecord { Id = report.Id }; Resource r = ReportResourceParser.ParseResource(html); if (r != null) { r.ToDB(resource); } Building b = ReportBuildingParser.ParseBuilding(html); if (b != null) { ObjectDumper.Dump(b, building); } Research s = ReportResearchParser.ParseResearch(html); if (s != null) { ObjectDumper.Dump(s, research); } Fleet f = ReportFleetParser.ParseFleet(html); ObjectDumper.Dump(f, fleet); Defence d = ReportDefenceParser.ParseDefence(html); ObjectDumper.Dump(d, defence); }catch (Exception ex) { Console.WriteLine(ex.ToString()); } return(true); }
public void Save(BuildingRecord building) { var record = _dao.Save(building); if (_cache == null) return; lock(_lock) { if (_cache == null) return; LoadData(record, _cache); } }
public static void Synchronize(RafManager manager) { List <BuildingRecord> records = new List <BuildingRecord>(); foreach (var file in manager.GetFiles("ObjectCFG.cfg")) { CFGFile cfg = new CFGFile(file.GetContent(true)); int mapId = Helper.GetMapId(file.Path); foreach (var obj in cfg.Objects) { BuildingRecord record = new BuildingRecord(); record.MapId = mapId; record.Name = obj.Key; record.Health = GetFloatFromCFG(obj.Value, "mMaxHP", 0); record.CollisionRadius = GetFloatFromCFG(obj.Value, "Collision Radius", 0); record.BaseStaticHpRegen = GetFloatFromCFG(obj.Value, "mBaseStaticHPRegen", 0); record.CollisionHeight = GetFloatFromCFG(obj.Value, "Collision Height", 0); record.Mana = GetFloatFromCFG(obj.Value, "mMaxMP", 0); record.SelectionHeight = GetFloatFromCFG(obj.Value, "SelectionHeight", 0); record.SelectionRadius = GetFloatFromCFG(obj.Value, "SelectionRadius", 0); record.SkinId = GetIntFromCFG(obj.Value, "skinID", 0); record.SkinName1 = GetStringFromCFG(obj.Value, "SkinName1", string.Empty); record.SkinName2 = GetStringFromCFG(obj.Value, "SkinName2", string.Empty); record.Rot = GetStringFromCFG(obj.Value, "Rot", string.Empty); record.Move = GetStringFromCFG(obj.Value, "Move", string.Empty); record.PerceptionBubbleRadius = GetFloatFromCFG(obj.Value, "PerceptionBubbleRadius", 0); record.PathfindingCollisionRadius = GetFloatFromCFG(obj.Value, "PathfindingCollisionRadius", 0); records.Add(record); } } foreach (var record in records) { record.AddElement(); } logger.Write("Buildings Synchronized"); }
protected void SpawnAITurret(string turretName, string aiUnitRecordName, string customAIUnitRecord = null) { AIUnitRecord aIUnitRecord = AIUnitRecord.GetAIUnitRecord(customAIUnitRecord != null ? customAIUnitRecord : aiUnitRecordName); MapObjectRecord objectRecord = Game.Map.Record.GetObject(turretName); if (objectRecord == null) { logger.Write(string.Format(SPAWN_EX_STRING, turretName, "the GameObjectRecord do not exist."), MessageState.WARNING); return; } if (aIUnitRecord == null) { logger.Write(string.Format(SPAWN_EX_STRING, turretName, "the AIUnitRecord do not exist."), MessageState.WARNING); return; } string fullName = turretName + BuildingProvider.TOWER_SUFFIX; var teamId = BuildingProvider.Instance.GetTeamId(turretName); if (teamId != TeamId.UNKNOWN) { uint netId = (uint)(BuildingProvider.BUILDING_NETID_X | CRC32.Compute(Encoding.ASCII.GetBytes(fullName))); AITurret turret = new AITurret(netId, aIUnitRecord, objectRecord, BuildingRecord.GetBuildingRecord(Game.Map.Id, turretName), BuildingProvider.TOWER_SUFFIX); turret.DefineGame(Game); Game.AddUnitToTeam(turret, teamId); Game.Map.AddUnit(turret); if (customAIUnitRecord != null) { turret.AddStackData(customAIUnitRecord, 0, false, true, true, false); } } else { logger.Write(string.Format(SPAWN_EX_STRING, turretName, "Unable to find a team."), MessageState.WARNING); } }
public BuildingStats(BuildingRecord record) : base(record.Health, record.Mana, record.BaseStaticHpRegen, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, record.PerceptionBubbleRadius, 0, 1f) { }
private void LoadData(BuildingRecord record, ConcurrentDictionary<int, IBuilding> cache) { int buildingID = record.BuildingID; Lazy<IEnumerable<IDoor>> doors = new Lazy<IEnumerable<IDoor>>(() => _doorRepository.Value.GetAll().Where(_=>_.BuildingID == buildingID)); cache[record.BuildingID] = Mapper.Map(record, new Building(doors)); }
public AnimatedBuilding(uint netId, BuildingRecord buildingRecord, MapObjectRecord mapObjectRecord) : base(netId, buildingRecord, mapObjectRecord) { this.Position = new Vector2(mapObjectRecord.Position.X, mapObjectRecord.Position.Y); }
public Building(uint netId, BuildingRecord buildingRecord, MapObjectRecord mapObjectRecord) : base(netId) { this.BuildingRecord = buildingRecord; this.MapObjectRecord = mapObjectRecord; }
public TurretStats(AIUnitRecord record, BuildingRecord buildingRecord) : base((float)record.BaseHp, (float)record.BaseMp, (float)record.BaseHpRegen, (float)record.BaseArmor, (float)record.BaseDamage, record.BaseAbilityPower, (float)record.BaseDodge, (float)record.BaseCritChance, (float)record.BaseMagicResist, (float)record.BaseMpRegen, record.AttackRange, (float)record.BaseAttackSpeed, (float)record.AttackDelayOffsetPercent, AIHero.DEFAULT_COOLDOWN_REDUCTION, 0, 0, 0, 0, 0, DEFAULT_PERCEPTION_BUBBLE_RADIUS, record.BaseMovementSpeed, 1) { }
public Turret(uint netId, BuildingRecord buildingRecord, MapObjectRecord mapObjectRecord) : base(netId, buildingRecord, mapObjectRecord) { }
public Inhibitor(uint netId, BuildingRecord buildingRecord, MapObjectRecord mapObjectRecord) : base(netId, buildingRecord, mapObjectRecord) { Death = new InhibitorDeath(this, TIME_TO_RESPAWNING_SOON_SECONDS); }