public EngineContainer GetEngineByFilename(string filename) { var engines = Engines .Where(e => e.Metadata.Category.Contains(".")) .Where(e => FileMatchesEngine(filename, e.Metadata)) .ToList(); if (!engines.Any()) { engines = Engines .Where(e => !e.Metadata.Category.Contains(".")) .Where(e => FileMatchesEngine(filename, e.Metadata)) .ToList(); } if (!engines.Any()) { return(null); } if (!CheckEngines(engines)) { var engineNames = engines.Select(e => string.Format("{0} ({1})", e.Metadata.Name, e.Metadata.Internal ? "Internal" : "External")); var message = string.Format("There are multiple engines which can handle '{0}'\n{1}", filename, string.Join(", ", engineNames)); throw new InvalidOperationException(message); } return(GetEngineByName(engines.First().Metadata.Name)); }
public void StartGame(PetRecord selfPet, PetRecord aimPet, long groupNum, string bindAi) { var engine = new PetAgainstEngine() { SelfPet = new GamingPet() { Name = selfPet.Name, HP = PetLevelSvc[selfPet.Level].HP, QQNum = selfPet.QQNum, Skills = new Dictionary <string, int>(selfPet.Skills), Level = selfPet.Level }, AimPet = new GamingPet() { Name = aimPet.Name, HP = PetLevelSvc[aimPet.Level].HP, QQNum = aimPet.QQNum, Skills = new Dictionary <string, int>(aimPet.Skills), Level = aimPet.Level }, GroupNum = groupNum, BindAi = bindAi }; Engines.Add(engine); engine.StartGame(); Engines.Remove(engine); }
/// <summary> /// Akcja kliknięcia na Zapisz /// </summary> /// <param name="sender"></param> /// <param name="e"></param> private void SaveMenu_Click(object sender, EventArgs e) { if (string.IsNullOrEmpty(CarName)) { //MessageBox.Show("Wprowadź nazwę nowego samochodu!"); tbCarName.Focus(); return; } if (Engine == null) { //MessageBox.Show("Wybierz silnik!"); Engines.Show(); return; } if (CarHolder.Instance.Cars.FirstOrDefault(p => p.Name.ToUpper() == CarName.ToUpper()) != null) { MessageBox.Show(string.Format("Istnieje już samochód o nazwie {0}!", CarName), "Błąd!", MessageBoxButton.OK); return; } MessageBox.Show(string.Format("Dodałeś {0} [{1}]!\n Zostaniesz przekierowany do menu.", CarName, Engine), "Informacja", MessageBoxButton.OK); CarHolder.Instance.Cars.Add(new Car() { CreateTime = DateTime.Now, Engine = Engine, Name = CarName }); CarHolder.Instance.SaveDataInStorage(); NavigationService.GoBack(); }
/// <summary> /// Clears the value of the given property. /// </summary> /// <param name="propertyName">The name of the property whose value to clear.</param> public void ClearPropertyValue(string propertyName) { switch (propertyName) { case nameof(Size): Size = Sizes.NotDefined; break; case nameof(Engines): Engines.Clear(); break; case nameof(Weapons): Weapons.Clear(); break; case nameof(Crew): Crew = CrewTypes.NotDefined; break; case nameof(Name): Name = string.Empty; break; } }
/// <summary> /// Checks if the given spaceship is partial match to this one. /// Any differences (other than properties not defined) will be considered mismatch. /// </summary> /// <param name="other">The spaceship to compare to this one.</param> /// <returns>True, if the spaceships are a partial match. False otherwise.</returns> public bool IsPartialMatch(Spaceship other) { if (other == null) { return(false); } if (other.Size != Sizes.NotDefined && other.Size != Size) { return(false); } foreach (EngineTypes engineType in other.Engines) { if (!Engines.Contains(engineType)) { return(false); } } foreach (WeaponTypes weaponType in other.Weapons) { if (!Weapons.Contains(weaponType)) { return(false); } } if (other.Crew != CrewTypes.NotDefined && other.Crew != Crew) { return(false); } return(true); }
public void CorrectGetEngineByString(string input) { var pilots = new Mock <ICarServices>(); var parts = new Engines { Name = "Engine", Price = 100, Speed = 40, Strength = 50, IsDeleted = false, }; pilots.Setup(x => x.GetEngine(It.IsAny <string>())) .Returns(parts); var result = pilots.Object.GetEngine(input); var resultName = result.Name; var resultPrice = result.Price; var resultSpeed = result.Speed; var resultId = result.IsDeleted; Assert.Equal(false, resultId); Assert.Equal(40, resultSpeed); Assert.Equal(100, resultPrice); Assert.Equal("Engine", resultName); }
public void AddEngine(EngineTypes engineType) { if (!Engines.Contains(engineType)) { Engines.Add(engineType); } }
internal void EnsurePopulated() { if (Lights == null) { Lights = new AircraftConfigurationLights(); } Lights.EnsurePopulated(); if (Engines == null) { Engines = new AircraftConfigurationEngines(); } Engines.EnsurePopulated(); if (!GearDown.HasValue) { GearDown = true; } if (!FlapsPercent.HasValue) { FlapsPercent = 0; } if (!SpoilersDeployed.HasValue) { SpoilersDeployed = false; } if (!OnGround.HasValue) { OnGround = true; } }
void SetEngineList() { Dictionary <string, Engine> Engines; if (showedType == Engine.EngineType.WEB) { Engines = EngineListManager.Instance.WebEngines; } else { Engines = EngineListManager.Instance.ImageEngines; } if (Engines.Count > 0) { actualEngine = Engines.First().Value; if (tileEngine != null && tileEngine != "NONE") { Engines.TryGetValue(tileEngine, out actualEngine); } EngineName.Text = actualEngine.Name; EngineList.ItemsSource = Engines.Keys.ToList <string>(); } else { actualEngine = null; MessageBox.Show(AppResources.ErrorString); } }
internal AircraftConfiguration CreateIncremental(AircraftConfiguration cfg) { EnsurePopulated(); cfg.EnsurePopulated(); AircraftConfiguration inc = new AircraftConfiguration { Lights = Lights.CreateIncremental(cfg.Lights), Engines = Engines.CreateIncremental(cfg.Engines) }; if (cfg.GearDown != GearDown) { inc.GearDown = cfg.GearDown; } if (cfg.FlapsPercent != FlapsPercent) { inc.FlapsPercent = cfg.FlapsPercent; } if (cfg.SpoilersDeployed != SpoilersDeployed) { inc.SpoilersDeployed = cfg.SpoilersDeployed; } if (cfg.OnGround != OnGround) { inc.OnGround = cfg.OnGround; } return(inc); }
internal void ApplyIncremental(AircraftConfiguration inc) { if (inc.Lights != null) { Lights.ApplyIncremental(inc.Lights); } if (inc.Engines != null) { Engines.ApplyIncremental(inc.Engines); } if (inc.GearDown.HasValue) { GearDown = inc.GearDown.Value; } if (inc.FlapsPercent.HasValue) { FlapsPercent = inc.FlapsPercent.Value; } if (inc.SpoilersDeployed.HasValue) { SpoilersDeployed = inc.SpoilersDeployed.Value; } if (inc.OnGround.HasValue) { OnGround = inc.OnGround.Value; } }
public AddChatiment(int value, int element, int duration, Fights.Fighter fighter, Engines.Spells.SpellLevel spell) : base(duration, true, fighter) { this.Element = element; this.Value = value; this.Spell = spell; }
public EngineContainer GetEngineByName(string name) { var engine = LoadFromCache(name); if (engine != null) { return(engine); } var engines = Engines .Where(e => e.Metadata.Name.Equals(name, StringComparison.InvariantCultureIgnoreCase)) .ToList(); if (!engines.Any()) { return(null); } if (!CheckEngines(engines)) { var engineNames = engines.Select(e => string.Format("{0} ({1})", e.Metadata.Name, e.Metadata.Internal ? "Internal" : "External")); var message = string.Format("There are multiple engines defined for the name '{0}'\n{1}", name, string.Join(", ", engineNames)); throw new InvalidOperationException(message); } return(SaveCache(name, engines)); }
public void BuildBox(SearchResultModel model) { foreach (var item in model.Items) { ProcessItem(item); } var box = new StatBox() { Title = BoxTitle }; model.StatBoxs.Add(box); foreach (var engine in Engines.OrderByDescending(o => o.Counter).Take(10)) { var red = new StatItem() { Title = engine.Name, Value = engine.Counter, Link = "#" }; box.StatItems.Add(red); if (model.Items.Count > 0) { red.ValueText = ((decimal)engine.Counter / model.Items.Count * 100).ToString("f") + "%"; red.ValuePercent = ((decimal)engine.Counter / model.Items.Count * 100); } else { red.ValueText = "0%"; red.ValuePercent = 0; } } }
static void InitializePrototypes() { // #TODO_BLAM: if we use a 'null' engine entry, add it here, before the prototypes are read using (var s = OpenRegistryTagElementStream()) { SerializePrototypes(s); SerializeTargets(s); } KSoft.Debug.ValueCheck.IsLessThanEqualTo("EngineRegistry: Too many registered engines", BlamEngine.kMaxCount, Engines.Count); KSoft.Debug.ValueCheck.IsLessThanEqualTo("EngineRegistry: Too many registered target platforms", EngineTargetPlatform.kMaxCount, TargetPlatforms.Count); KSoft.Debug.ValueCheck.IsLessThanEqualTo("EngineRegistry: Too many registered resource models", kMaxResourceModels, ResourceModels.Count); KSoft.Debug.ValueCheck.IsDistinct("EngineRegistry: Duplicate engines registered", "name", Engines.Select(e => e.Name)); KSoft.Debug.ValueCheck.IsDistinct("EngineRegistry: Duplicate target platforms registered", "name", TargetPlatforms.Select(e => e.Name)); KSoft.Debug.ValueCheck.IsDistinct("EngineRegistry: Duplicate resource models registered", "name", ResourceModels); gEngines.TrimExcess(); gTargetPlatforms.TrimExcess(); gResourceModels.TrimExcess(); BlamEngine.InitializeEngineBuildHandles(); kNullValidTargetPlatforms = new Collections.BitSet(TargetPlatforms.Count); InitializeTargetPlatformIndicies(); }
public FightShield(Fighter caster, Fighter protectedFighter, Engines.Spells.SpellLevel spellLevel, int element) { this.Caster = caster; this.ProtectedFighter = protectedFighter; this.SpellLevel = spellLevel; this.ProtectedElements.Add(element); }
public double GetStageMass() { double stageMass = Engines.Sum(engines => engines.EngineMass) + FuelTanks.Sum(fuelTanks => fuelTanks.FuelTankMass); return(stageMass); }
/// <summary> /// Init fight with mobs /// </summary> public Fight(Fighter fighter1, Engines.Map.MonsterGroup monsters, Engines.MapEngine map, Enums.FightTypeEnum fightType = Enums.FightTypeEnum.PvM) { //Stop the bonus timer monsters.StopBonusTimer(); this.FightType = fightType; this.Map = map; this.ID = this.Map.GetActorAvailableID; this.RedTeam = new FightTeam(0, fighter1, this, false); this.BlueTeam = new FightTeam(1, new Fighter(-9, monsters.Leader, monsters), this, true); this.InitPlaces(); this.InitMontersGroup(monsters); this.InitTimeline(); this.PlacePlayer(fighter1); this.StartTime = Environment.TickCount; this.InitCheckFight(); if (FightType == Enums.FightTypeEnum.PvM) { this.StartTimer = new System.Timers.Timer(30000); this.StartTimer.Enabled = true; this.StartTimer.Elapsed += new System.Timers.ElapsedEventHandler(StartTimer_Elapsed); this.StartTimer.Start(); } }
private void LoadOfferSettings() { Offer = m_Offer.GetOffer(OfferID, LoadOfferOptions.None); Engine = (Engines)Offer.EngineID; IsTemplate = Offer.IsTemplate; FromTemplate = Offer.FromTemplate; }
public static void AddChatiment(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets, Engines.Spells.SpellLevel spellLevel) { foreach (Fighter target in targets) { target.AddBuff(caster.ID, new Spells.Buffs.AddChatiment(effect.Value2, effect.Value, 4, target, spellLevel), 0, effect.Value, true, effect); } }
void Refresh() { try { Engines.Clear(); foreach (var item in new EnginesRequest().Response.Engines.Data.Select(d => new Item() { Name = d["title"], Value = d["name"], Data = d })) { Engines.Add(item); } Markets.Clear(); Securities.Clear(); Boards.Clear(); Info = ""; History = new List <HistoryObject>(); FirePropertyChanged(nameof(Info)); FirePropertyChanged(nameof(History)); } catch (Exception e) { MessageBox.Show(e.Message, "Error"); } }
void Awake() { // Check if null in prod... engines = GetComponent <Engines>(); playerAvatar = GetComponent <PlayerAvatar>(); bulletGun = GetComponent <BulletGun>(); }
public static void AddArmor(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets) { foreach (var target in targets) { target.AddBuff(caster.ID, new Spells.Buffs.AddArmorBuff(effect.Value, effect.Turn, target), 0, effect.Value, true, effect); } }
public Transport(TypesOfTransport tt, string rn, Engines en, int p) { TypeOfTransport = tt; RegNumber = rn; TypeOfEngine = en; PowerOfEngine = p; }
public void Add(EngineWrapper e) { Engines.Add(e); MaxThrust = MaxThrust + VSL.LocalDir(e.defThrustDir) * e.engine.maxThrust; MaxMassFlow = MaxMassFlow + e.engine.maxFuelFlow; Dir = MaxThrust.normalized; }
public static void Seed(ApplicationDbContext context) { if (!context.Engines.Any()) { context.Engines.AddRange(Engines.Select(c => c.Value)); } context.SaveChanges(); if (!context.Fuels.Any()) { context.Fuels.AddRange(Fuels.Select(c => c.Value)); } context.SaveChanges(); if (!context.Brands.Any()) { context.Brands.AddRange(Brands.Select(c => c.Value)); } context.SaveChanges(); if (!context.Cars.Any()) { context.Cars.AddRange(Cars.Select(c => c.Value)); } context.SaveChanges(); }
private void initializePriceChangeValues() { for (int i = 0; i < Constants.NUMBER_OF_DRIVERS; i++) { Driver driver = Drivers.ElementAt(i); float initialNewPrice = Constants.PRICING_PRICE_COEFFICIENT * driver.Price; initialNewPrice = initialNewPrice >= 0.5 ? initialNewPrice : 0.5F; float initialPriceChange = initialNewPrice - driver.Price; initialPriceChange = RoundFloat.round(initialPriceChange); Drivers.ElementAt(i).PriceChange = initialPriceChange; Form.DriverPriceChangeLabels[i].Text = initialPriceChange.ToString(); Form.ColorLabels(Form.DriverPriceChangeLabels[i], initialPriceChange); } for (int i = 0; i < Constants.NUMBER_OF_TEAMS; i++) { Team team = Teams.ElementAt(i); team.UpdatePriceChange(); Form.TeamPriceChangeLabels[i].Text = team.PriceChange.ToString(); Form.ColorLabels(Form.TeamPriceChangeLabels[i], team.PriceChange); } for (int i = 0; i < Constants.NUMBER_OF_ENGINES; i++) { Engine engine = Engines.ElementAt(i); engine.UpdatePriceChange(); Form.EnginePriceChangeLabels[i].Text = engine.PriceChange.ToString(); Form.ColorLabels(Form.EnginePriceChangeLabels[i], engine.PriceChange); } }
public virtual void IdlePower(Engine engine) { if (Engines.Contains(engine, new Engine.EngineComparer())) { Engines.Where(v => v.SerialNumber == engine.SerialNumber).Select(v => v).First().CurrentPower = 1; } }
public SnipsNLUService(string engineDirectory) : base() { EnginesDirectory = new DirectoryInfo(engineDirectory); if (!EnginesDirectory.Exists) { return; } var dirs = EnginesDirectory.EnumerateDirectories(); foreach (var d in dirs) { var e = new SnipsNLUEngine(d.FullName, Api.Ct); if (e.Initialized) { Engines.Add(d.Name, e); } } if (Engines.Count == 0) { Error("Did not initialize any Snips NLU engines from directory {0}", engineDirectory); return; } else { Initialized = true; Info("Initialized {0} Snips NLU engines: {1}.", Engines.Count, Engines.Keys); } }
public void InitEngines(Assembly setupAssembly) { //InitWithPatterns(setupAssembly, History()); InitFromAssembly(setupAssembly); DefaultInstance = Engines.SingleOrDefault((e) => (e.Key.DefaultPattern)).Value; }
private void Start() { // Retrieve the player avatar of the game object. this.playerAvatar = this.GetComponent <PlayerAvatar>(); if (this.playerAvatar == null) { Debug.LogWarning("There is no player avatar on the game object."); } // Retrieve the engines of the game object. this.engines = this.GetComponent <Engines>(); if (this.engines == null) { Debug.LogWarning("There is no engines on the game object."); } // Retrieve the bullet guns of the game object. this.bulletGuns = this.GetComponents <BulletGun>(); if (this.bulletGuns == null || this.bulletGuns.Length == 0) { Debug.LogWarning("There is no bullet guns on the game object."); } }
public void UpdateDreamTeamComponents(int driverIndex, int qPosition, int rPosition) { float points = Constants.qualificationPositionToPointsMap[qPosition] + Constants.racePositionToPointsMap[rPosition]; float newPrice = Constants.PRICING_PRICE_COEFFICIENT * Drivers.ElementAt(driverIndex).Price + Constants.PRICING_POINTS_COEFFICIENT * points; newPrice = newPrice >= 0.5 ? newPrice : 0.5F; float priceChange = newPrice - Drivers.ElementAt(driverIndex).Price; priceChange = RoundFloat.round(priceChange); Drivers.ElementAt(driverIndex).Points = points; Drivers.ElementAt(driverIndex).PriceChange = priceChange; Form.DriverPointsLabels[driverIndex].Text = points != 0 ? points.ToString() : ""; Form.DriverPriceChangeLabels[driverIndex].Text = priceChange.ToString(); Form.ColorLabels(Form.DriverPriceChangeLabels[driverIndex], priceChange); for (int i = 0; i < Constants.NUMBER_OF_TEAMS; i++) { Team team = Teams.ElementAt(i); team.UpdatePoints(); team.UpdatePriceChange(); Form.TeamPointsLabels[i].Text = team.Points != 0 ? team.Points.ToString() : ""; Form.TeamPriceChangeLabels[i].Text = team.PriceChange.ToString(); Form.ColorLabels(Form.TeamPriceChangeLabels[i], team.PriceChange); } for (int i = 0; i < Constants.NUMBER_OF_ENGINES; i++) { Engine engine = Engines.ElementAt(i); engine.UpdatePoints(); engine.UpdatePriceChange(); Form.EnginePointsLabels[i].Text = engine.Points != 0 ? engine.Points.ToString() : ""; Form.EnginePriceChangeLabels[i].Text = engine.PriceChange.ToString(); Form.ColorLabels(Form.EnginePriceChangeLabels[i], engine.PriceChange); } }
public string GetInfo() { return($"On this stage installed {Engines.Count()} engines and {FuelTanks.Count()} fuel tanks" + $"{Environment.NewLine}Stage mass: {_stageMass} tons" + $"{Environment.NewLine}Stage fuel tanks capacity: {_fuelTanksCapacity} tons" + $"{Environment.NewLine}Stage fuel consumption: {_fuelConsumption} tons/sec"); }
public void Save(SerializableShip serializable) { serializable.ShipCategory = ShipCategory; serializable.Name = Name; serializable.Faction = FactionId.Id; serializable.SizeClass = SizeClass; serializable.IconImage = IconImage; serializable.IconScale = IconScale.Value; serializable.ModelImage = ModelImage; serializable.ModelScale = ModelScale.Value; serializable.EnginePosition = EnginePosition; serializable.EngineColor = Helpers.ColorToString(EngineColor); serializable.EngineSize = EngineSize.Value; serializable.EnergyResistance = EnergyResistance.Value; serializable.KineticResistance = KineticResistance.Value; serializable.HeatResistance = HeatResistance.Value; serializable.Regeneration = Regeneration; serializable.BaseWeightModifier = BaseWeightModifier.Value; serializable.Layout = Layout.Data; serializable.BuiltinDevices = BuiltinDevices?.Select(device => device.Item.Id).ToArray(); serializable.Barrels = Barrels?.Select(item => item.Serialize()).ToArray(); serializable.Engines = Engines?.Select(item => new SerializableShip.Engine { Position = item.Position, Size = item.Size.Value }).ToArray(); }
private void AddEngine() { MESEngine engine = new MESEngine(); MESEngineViewModel vm = new MESEngineViewModel(engine); Engines.Add(vm); _mes.engines.Add(engine); }
public FightTrap(Fighter owner, int spellID, int level, Engines.Spells.SpellLevel spellLevel, int cellID, int lenght, Enums.FightTrapType type) { this.Owner = owner; this.SpellLevel = spellLevel; this.CellID = cellID; this.Lenght = lenght; this.TrapType = type; this.ProcessCellsZone(); this.UsedEffect = Helper.SpellHelper.GetSpell(spellID).Engine.GetLevel(level); }
public static void DeathVersusMonster(List<Fights.Fighter> fighters, Engines.Map.MonsterGroup group) { foreach (var f in fighters) { if (f.IsHuman)//Check if is a human, because maybe contains summon { DeathVersusMonster(f, group); } } }
public static string CreateStringPath(int baseCell, int baseDir,List<int> cells, Engines.MapEngine map) { string path = GetDirChar(baseDir) + GetCellChars(baseCell); foreach (int cell in cells) { path += GetDirChar(map.PathfindingMaker.GetDirection(baseCell, cell)) + GetCellChars(cell); baseCell = cell; } return path; }
/// <summary> /// Initialize Profile API /// </summary> /// <param name="userprofileRepo">User profile repository</param> /// <param name="classCalendarRepo">Class calendar repository</param> /// <param name="backgroundProcessQueue">Background process queue</param> public ProfileController(IUserProfileRepository userprofileRepo, IClassCalendarRepository classCalendarRepo, IDateTime dateTime, Engines.IBackgroundProcessQueue backgroundProcessQueue, UserManager<ApplicationUser> userManager) { _userProfileRepo = userprofileRepo; _classCalendarRepo = classCalendarRepo; _dateTime = dateTime; _userManager = userManager; _backgroundProcessQueue = backgroundProcessQueue; }
public FightTrap(Fighter owner, int spellID, int level, Engines.Spells.SpellLevel spellLevel, int cellID, int lenght, Enums.FightTrapType type, int trapColor, int turn) { this.Owner = owner; this.SpellLevel = spellLevel; this.CellID = cellID; this.Lenght = lenght; this.TrapType = type; this.TrapColor = trapColor; this.TurnDuration = turn; this.ProcessCellsZone(); this.UsedEffect = Helper.SpellHelper.GetSpell(spellID).Engine.GetLevel(level); this.Owner.OwnGlyph.Add(this); }
public HomeController(CourseController courseCtrl, MyCourseController myCourseCtrl, IOptions<AppConfigOptions> options, IOptions<ErrorMessageOptions> errorMgs, ILoggerFactory loggerFactory, Engines.IEmailSender mindsageEmailSender) { _courseCtrl = courseCtrl; _myCourseCtrl = myCourseCtrl; _appConfig = options.Value; _errorMsgs = errorMgs.Value; _logger = loggerFactory.CreateLogger<CourseController>(); _mindsageEmailSender = mindsageEmailSender; }
public static void AddCCBuff(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets) { int addedCC = 0; if (effect.Value2 > 0 && effect.Value3 > 0) { addedCC = Utilities.Basic.Rand(effect.Value + effect.Value3, effect.Value2 + effect.Value3); } else { addedCC = effect.Value; } foreach (Fighter target in targets) { target.AddBuff(caster.ID, new Spells.Buffs.AddCriticalBuff(addedCC, effect.Turn, target), (int)effect.Effect, addedCC, true, effect); } }
public static void AddDamageFixBuff(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets) { int damagesAdded = 0; if (effect.Value2 > 0 && effect.Value3 > 0) { damagesAdded = Utilities.Basic.Rand(effect.Value + effect.Value3, effect.Value2 + effect.Value3); } else { damagesAdded = effect.Value; } foreach (Fighter target in targets) { target.AddBuff(caster.ID, new Spells.Buffs.AddFixDamage(damagesAdded, effect.Turn, target), (int)effect.Effect, damagesAdded, true, effect); } }
public Fighter(int id, Database.Records.MonsterLevelRecord monster, Engines.Map.MonsterGroup group) { this.Drops = new FightDrops(this); this.MonsterGroup = group; this.Monster = monster; this._id = id; this._currentLife = this.Monster.Life; this.IsHuman = false; this.IsReady = true; this.IsDead = false; switch (Monster.GetTemplate.AI) { case 0: this.ArtificialBrain = new AI.StaticAI(this); break; case 1: case 2: this.ArtificialBrain = new AI.BasicAI(this); break; case 3: this.ArtificialBrain = new AI.FearfulAI(this); break; case 4: this.ArtificialBrain = new AI.ScriptedAI(this); if (this.Monster.GetTemplate.HasScriptAI()) { var scriptID = this.Monster.GetTemplate.Script; var script = new PyScript("Scripts/AI/" + scriptID); script.Load(this); (this.ArtificialBrain as AI.ScriptedAI).Script = script; } break; } this.CurrentAP = Stats.GetMaxActionPoints; this.CurrentMP = Stats.GetMaxMovementPoints; }
public ManageController( UserManager<ApplicationUser> userManager, SignInManager<ApplicationUser> signInManager, IEmailSender emailSender, ISmsSender smsSender, ILoggerFactory loggerFactory, IUserProfileRepository userprofileRepo, Engines.IImageUploader imageUploader, Engines.IBackgroundProcessQueue backgroundProcessQueue, IOptions<ErrorMessageOptions> errorMsgs) { _userManager = userManager; _signInManager = signInManager; _emailSender = emailSender; _smsSender = smsSender; _logger = loggerFactory.CreateLogger<ManageController>(); _userprofileRepo = userprofileRepo; _imageUploader = imageUploader; _backgroundProcessQueue = backgroundProcessQueue; _errorMsgs = errorMsgs.Value; }
/// <summary> /// Init challenge player vs player /// </summary> public Fight(Fighter fighter1, Fighter fighter2, Engines.MapEngine map, Enums.FightTypeEnum fightType) { this.FightType = fightType; this.Map = map; this.ID = this.Map.GetActorAvailableID; this.InitTeam(fighter1, fighter2); this.InitPlaces(); this.InitTimeline(); this.PlacePlayer(fighter1); this.PlacePlayer(fighter2); this.StartTime = Environment.TickCount; this.InitCheckFight(); if (FightType == Enums.FightTypeEnum.Agression) { this.StartTimer = new System.Timers.Timer(30000); this.StartTimer.Enabled = true; this.StartTimer.Elapsed += new System.Timers.ElapsedEventHandler(StartTimer_Elapsed); this.StartTimer.Start(); } }
public static void DeathVersusMonster(Fights.Fighter fighter, Engines.Map.MonsterGroup group) { var skull = Helper.ItemHelper.GenerateItem(GetSkullBreedId(fighter.Character.Breed)); }
public static void SubPOBuff(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets) { int subPO = 0; if (effect.Value2 > 0 && effect.Value3 > 0) { subPO = Utilities.Basic.Rand(effect.Value + effect.Value3, effect.Value2 + effect.Value3); } else { subPO = effect.Value; } foreach (Fighter target in targets) { target.AddBuff(caster.ID, new Spells.Buffs.SubPOBuff(subPO, effect.Turn, target), (int)effect.Effect, subPO, true, effect); } }
public static void SummonCreature(Fight fight, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, Fighter caster, int cellID) { if (fight.GetFighterOnCell(cellID) == null) { Database.Records.MonstersTemplateRecord template = World.Helper.MonsterHelper.GetMonsterTemplate(effect.Value); if (template != null) { Database.Records.MonsterLevelRecord level = template.Levels.FirstOrDefault(x => x.Level == spellLevel.Level); if (level != null) { Fighter summonedCreature = new Fighter(fight.CurrentEntityTempID, level, null); summonedCreature.CellID = cellID; summonedCreature.SummonOwner = caster.ID; summonedCreature.IsInvoc = true; fight.CurrentEntityTempID--; fight.AddPlayer(summonedCreature, caster.Team.ID, cellID); fight.TimeLine.RemixTimeLine(); fight.TimelineDisplay(); } } } }
public void RemoveMonstersOnMap(Engines.Map.MonsterGroup monsters) { this.Send("GM|-" + monsters.ID); this.Spawner.GroupsOnMap.Remove(monsters); }
public static void SummonDouble(Fight fight, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, Fighter caster, int cellID) { /* Create temp template for double summoned */ Database.Records.MonstersTemplateRecord tempTemplate = new Database.Records.MonstersTemplateRecord() { ID = -1, Color1 = caster.Character.Color1, Color2 = caster.Character.Color2, Color3 = caster.Character.Color3, Skin = caster.Character.Look, Name = caster.Nickname, Exp = 0, Kamas = "0,0", Drops = "", AI = 2, }; Database.Records.MonsterLevelRecord tempLevel = new Database.Records.MonsterLevelRecord() { ID = -1, TemplateID = -1, IsTempLevel = true, TempTemplate = tempTemplate, Level = caster.Level, AP = caster.Stats.GetMaxActionPoints, MP = caster.Stats.GetMaxMovementPoints, Life = caster.Stats.MaxLife, Size = caster.Character.Scal, Stats = "0,0,0,0,0", ProtectStats = "0,0,0,0", Spells = "", }; tempLevel.InitMonster(); Fighter summonedCreature = new Fighter(fight.CurrentEntityTempID, tempLevel, null); summonedCreature.CellID = cellID; summonedCreature.SummonOwner = caster.ID; summonedCreature.IsInvoc = true; fight.CurrentEntityTempID--; fight.AddPlayer(summonedCreature, caster.Team.ID, cellID); fight.TimeLine.RemixTimeLine(); fight.TimelineDisplay(); }
public static void Transpose(Fight fight, Fighter caster, List<Fighter> targets, int cellID, Engines.Spells.SpellEffect effect) { if (caster.CellID != cellID) { foreach (Fighter transposed in targets) { int casterCell = caster.CellID; int transposedCell = transposed.CellID; caster.CellID = transposedCell; transposed.CellID = casterCell; fight.Send("GA0;4;" + caster.ID + ";" + caster.ID + "," + caster.CellID); fight.Send("GA0;4;" + transposed.ID + ";" + transposed.ID + "," + transposed.CellID); } } }
public static void UseInvisibleState(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets, int cellID) { foreach (Fighter target in targets) { target.AddBuff(caster.ID, new Spells.Buffs.InvisibleBuff(0, effect.Turn, target), (int)effect.Effect, 0, false, effect); } }
public static void UseTrap(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, Engines.Spells.SpellLevel spellLevel, int cell) { fight.AddTrap(new FightTrap(caster, effect.Value, effect.Value2, spellLevel, cell, Engines.Pathfinding.GetDirNum(spellLevel.TypePO.Substring(1, 1)), Enums.FightTrapType.TRAP)); }
public static void Wear(Fight fight, Fighter caster, Engines.Spells.SpellEffect effect, List<Fighter> targets, int cellID) { foreach (Fighter target in targets) { if (caster.WearedFighter == null) { caster.Wear(target); } } }
public void AddBuff(int caster, Engines.Spells.SpellBuff buff, int spriteID, int value, bool sendPacket, Engines.Spells.SpellEffect effect) { this.Buffs.Add(buff); buff.ApplyBuff(); if (sendPacket) { this.Team.Fight.Send("GA;" + spriteID + ";" + caster + ";" + ID + "," + value + "," + buff.Duration); string packetShowedBuffInStatusBar = "GIE" + (int)effect.Effect; packetShowedBuffInStatusBar += ";" + this.ID; packetShowedBuffInStatusBar += ";" + effect.Value.ToString(); packetShowedBuffInStatusBar += ";" + (effect.Value2.ToString() != "-1" ? effect.Value2.ToString() : "").ToString(); packetShowedBuffInStatusBar += ";" + (effect.Value3.ToString() != "-1" ? effect.Value3.ToString() : "").ToString(); packetShowedBuffInStatusBar += ";" + (effect.Chance.ToString() != "-1" ? effect.Chance.ToString() : "").ToString(); packetShowedBuffInStatusBar += ";" + (effect.Turn > 0 ? effect.Turn.ToString() : "").ToString(); packetShowedBuffInStatusBar += ";" + effect.Engine.Spell.ID.ToString(); this.Team.Fight.Send(packetShowedBuffInStatusBar); } }
/// <summary> /// Chaotic ReSeed Random Generator: /// Generate a block of random bytes using dual or single AES CTRs. /// Uses a dual/single CTR xor with independant random state resets. /// Use the Engine property to toggle modes. /// </summary> /// <param name="Size">Size of data return in bytes. [recommended min. 102400 max. 10240000].</param> /// <param name="Seed">Random seed, Fixed size 96 bytes</param> /// <param name="Engine">The AES engine type, single CTR, or Dual xored CTRs</param> /// <returns>Random data [byte[]]</returns> public byte[] Generate(Int32 Size, byte[] Seed, Engines Engine) { if (Engine == Engines.DUAL) return GenerateT2(Size, Seed); else return GenerateT1(Size, Seed); }
/// <summary> /// Chaotic ReSeed Random Generator: /// Generate a block of random bytes using dual or single AES CTRs. /// Uses a dual/single CTR xor with independant random state resets. /// Use the Engine property to toggle modes. /// </summary> /// <param name="Size">Size of data return in bytes. [recommended min. 102400 max. 10240000].</param> /// <param name="Seed">Random seed, Fixed size 96 bytes.</param> /// <param name="Engine">The AES engine type, single CTR, or Dual xored CTRs</param> /// <param name="Differential">The reseed modulus differential. Smaller values mean more reseeds (slower)</param> /// <returns>Random data [byte[]]</returns> public byte[] Generate(Int32 Size, byte[] Seed, Engines Engine, Differentials Differential) { this.StateDifferential = Differential; if (Engine == Engines.DUAL) return GenerateT2(Size, Seed); else return GenerateT1(Size, Seed); }
public void ApplyEffects(Fighter fighter, Engines.Spells.SpellLevel spellLevel, List<Engines.Spells.SpellEffect> effects, int cellid, bool cc, bool IsTrap, List<Fighter> onTrap = null) { int effectNum = 0; foreach (Engines.Spells.SpellEffect effect in effects) { try { #region Zone string viewEffect = "Pa"; try { string viewType = cc ? spellLevel.TypePO.Substring(spellLevel.Effects.Count * 2) : spellLevel.TypePO.Substring(0, spellLevel.Effects.Count * 2); viewEffect = viewType.Substring(effectNum * 2, 2); } catch (Exception e) { viewEffect = "Pa"; } List<Fighter> targets = null; if (IsTrap) { targets = onTrap; } else { targets = GetFighterInZone(viewEffect, cellid); } #endregion #region Targets if (effect.Targets != null) { //Check targets if (!effect.Targets.Ennemies) { targets.ToArray().ToList().FindAll(x => !fighter.Team.IsFriendly(x)).ForEach(x => targets.Remove(x)); } if (!effect.Targets.Friends) { targets.ToArray().ToList().FindAll(x => fighter.Team.IsFriendly(x)).ForEach(x => targets.Remove(x)); } if (!effect.Targets.Caster) { if (targets.Contains(fighter)) targets.Remove(fighter); } if (effect.Targets.CasterPlus) { if (!targets.Contains(fighter)) targets.Add(fighter); } //Manual fix //Dissolution if (spellLevel.Engine.Spell.ID == 439) { if (targets.Contains(fighter)) targets.Remove(fighter); } } //Reverse spell foreach (var target in targets.ToArray()) { if (target.HasReverseSpellBuff() != null && !target.Team.IsFriendly(fighter)) { if (target.HasReverseSpellBuff().Level >= spellLevel.Level) { targets.Remove(target); targets.Add(fighter); this.Send("GA;106;" + target.ID + ";" + target.ID + ",1"); } } } #endregion FightSpellEffects.ApplyEffect(this, effect, spellLevel, fighter, cellid, targets); } catch (Exception e) { Console.WriteLine("Error : " + e.ToString()); } effectNum++; } }
public void InitMontersGroup(Engines.Map.MonsterGroup group) { foreach (Database.Records.MonsterLevelRecord monster in group.Monsters) { Fighter monsterFighter = new Fighter(this.CurrentEntityTempID, monster, group); this.BlueTeam.AddToTeam(monsterFighter); this.PlacePlayer(monsterFighter); this.CurrentEntityTempID--; } }