private static string GetAdvType(Advantages item) { var typelist = new List <string>(); if (item.isPhysical != null && (bool)item.isPhysical) { typelist.Add("Physical"); } if (item.isMental != null && (bool)item.isMental) { typelist.Add("Mental"); } if (item.isMundane != null && (bool)item.isMundane) { typelist.Add("Mundane"); } if (item.isExotic != null && (bool)item.isExotic) { typelist.Add("Exotic"); } if (item.isSocial != null && (bool)item.isSocial) { typelist.Add("Social"); } if (item.isSuperNatural != null && (bool)item.isSuperNatural) { typelist.Add("Super-Natural"); } var type = string.Join(",", typelist); return(type); }
public IActionResult Create(Advantages manageClient) { try { if (ModelState.IsValid) { if (manageClient.Id == 0) { terms.Insert(manageClient); return(Json("1")); } else { terms.Update(manageClient); return(Json("1")); } } } catch (Exception e) { String S1 = e.ToString(); } return(View(manageClient)); }
public double ParseEffectiveness(List <BasicType> def) { var effect = 1.0; var defstr = $"{def[0].Type}"; if (def.Count > 1) { defstr += $"/{def[1].Type}"; } System.Console.WriteLine($"{Type} vs. {defstr}"); System.Console.WriteLine($"{this.GetType().ToString()}"); foreach (BasicType ty in def) { foreach (var adv in Advantages.Where(adv => ty.GetType() == adv.GetType())) { System.Console.WriteLine($"{Type} is advantagous against {ty.Type}"); effect *= 2.0; } foreach (var dis in Disadvantages.Where(dis => ty.GetType() == dis.GetType())) { System.Console.WriteLine($"{Type} is disadvantagous against {ty.Type}"); effect *= 0.5; } } return(effect); }
public IActionResult DeleteConfirmed(Advantages manage) { var id = manage.Id; terms.Delete(id); //return RedirectToAction(nameof(Index)); return(Json("1")); }
private string GetRequirements(Advantages advitem) { foreach (var item in _reqList.Where(item => item.SourceType == "Advantage").Where(item => item.SourceItemID == advitem.Id)) { return(item.TargetName); } return(""); }
private VampireSheet(Guid id, Header header, Attributes attributes, Abilities abilities, Advantages advantages, Status status) : base(id) { Header = header; Attributes = attributes; Abilities = abilities; Advantages = advantages; Status = status; }
public void InitControl(Advantages loadedAdvantage) { AdvantageId = loadedAdvantage.Id; LblAdvLabel.Content = loadedAdvantage.Name; TbDiscription.Text = loadedAdvantage.Discription; TbDiscription.Text += "\n\nLimitation:"; TbDiscription.Text += "\n" + loadedAdvantage.Limitation; LblAdvPoints.Content = loadedAdvantage.PointCost; }
public void Init() { st = 10; dx = 10; iq = 10; ht = 10; attackDelay = 2; advantages = new Advantages(this); disadvantages = new Disadvantages(this); }
public IActionResult Create(int id = 0) { Advantages model = new Advantages(); if (id > 0) { model = terms.GetById(id); } return(View(@"~/Areas/Admin/Views/Advantages/Create.cshtml", model)); }
public ActionResult Post([FromBody] Advantages advantages) { try { if (!ModelState.IsValid) { return(BadRequest()); } _advantagesService.Add(advantages); return(Ok()); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
private void PopulateAdvantageSideBar(Advantages item) { TbAdvType.Text = GetAdvType(item); TbAdvReq.Text = GetRequirements(item); TbAdvName.Text = item.Name; TxtbAdvDiscription.Text = item.Discription; TbAdvPointCost.Text = item.PointCost.ToString(); if (item.hasLevels != null && (bool)item.hasLevels) { LbladvLevel.Visibility = Visibility.Visible; } else { LbladvLevel.Visibility = Visibility.Hidden; } }
public ActionResult <Advantages> Get(int id) { try { Advantages advantages = _advantagesService.GetWithId(id); if (advantages == null) { return(StatusCode(StatusCodes.Status404NotFound)); } return(Ok(advantages)); } catch (Exception ex) { return(StatusCode(StatusCodes.Status500InternalServerError, ex.Message)); } }
public ActionResult Put(int id, [FromBody] Advantages advantages) { try { Advantages dbAdvatages = _advantagesService.GetWithId(id); if (dbAdvatages == null) { return(BadRequest()); } dbAdvatages.Icon = advantages.Icon; dbAdvatages.Title = advantages.Title; dbAdvatages.Description = advantages.Description; _advantagesService.Update(dbAdvatages); return(Ok()); } catch (Exception e) { return(StatusCode(StatusCodes.Status500InternalServerError, e.Message)); } }
private void btAddAdvantage_Click(object sender, RoutedEventArgs e) { var findcontext = new Db1Entities(); var foundstat = (from c in findcontext.Advantages where c.Name == TbName.Text select c).FirstOrDefault(); findcontext.Dispose(); if (foundstat == null) { if (TbName.Text == "") { MessageBox.Show("Please input a Name for the Advantage!"); } else { using (var newcontext = new Db1Entities()) { var adv = new Advantages { isEnabled = CbisEnabled.IsChecked != null && (bool)CbisEnabled.IsChecked, isPhysical = CbisPhysical.IsChecked != null && (bool)CbisPhysical.IsChecked, isSocial = CbisSocial.IsChecked != null && (bool)CbisSocial.IsChecked, isSuperNatural = CbisSuperNatural.IsChecked != null && (bool)CbisSuperNatural.IsChecked, isExotic = CbisExotic.IsChecked != null && (bool)CbisExotic.IsChecked, isMundane = CbisMundane.IsChecked != null && (bool)CbisMundane.IsChecked, isMental = CbisMental.IsChecked != null && (bool)CbisMental.IsChecked, Limitation = TbLimitation.Text, Discription = TbDiscription.Text, PointCost = Convert.ToInt32(TbPointCost.Text), hasLevels = CbhasLevels.IsChecked != null && (bool)CbhasLevels.IsChecked, Name = TbName.Text, isCreationLocked = CbisCreationLocked.IsChecked != null && (bool)CbisCreationLocked.IsChecked, Reference = TbReference.Text }; newcontext.Advantages.Add(adv); newcontext.SaveChanges(); foreach (Modifier item in LbModifier.Items) { UsedModifier usedmod; _dictMod.TryGetValue(item, out usedmod); var firstOrDefault = (from c in newcontext.Advantages where c.Name == adv.Name select c).FirstOrDefault(); if (firstOrDefault != null) { if (usedmod != null) { usedmod.ForeignId = firstOrDefault.Id; } } newcontext.UsedModifier.Add(usedmod); newcontext.SaveChanges(); } } MessageBox.Show("'" + TbName.Text + "' added to the Database"); TbName.Text = ""; } } else { MessageBox.Show("That Advantage allready exists in the Database!"); } LoadStackPanelContent(); ClearControls(); }
public Card(Suit suit, Advantages advantages) { this.suit = suit; this.advantages = advantages; }
private void PopulateAdvantageSideBar( Advantages item ) { TbAdvType.Text = GetAdvType(item); TbAdvReq.Text = GetRequirements(item); TbAdvName.Text = item.Name; TxtbAdvDiscription.Text = item.Discription; TbAdvPointCost.Text = item.PointCost.ToString(); if (item.hasLevels != null && (bool) item.hasLevels) { LbladvLevel.Visibility = Visibility.Visible; } else { LbladvLevel.Visibility = Visibility.Hidden; } }
// Constructor public PlayerViewModel(IBasePoints basePoints, IPlayerStat playerStat) { this.BasePoints = basePoints; this.PlayerStat = playerStat; this.Skills = new ObservableCollection <IActiveSkill>(); this.Advantages = new ObservableCollection <IActiveAdvantage>(); this.Disadvantages = new ObservableCollection <IActiveDisadvantage>(); AddAttributeCommand = new DelegateCommand(PlayerStat.AddAttribute, null); SubAttributeCommand = new DelegateCommand(PlayerStat.SubAttribute, null); Scope = IoCContainer.Container.BeginLifetimeScope(); AddSkillCommand = new DelegateCommand( x => { Skills.Add(Scope.Resolve <IActiveSkill>()); AddSkillCommand.OnCanExecuteChanged(); }, x => AddSkillCanExecute() ); RemoveSkillCommand = new DelegateCommand( x => { var SelectedItem = Scope.Resolve <ISelectedItem>(); IActiveSkill z = Skills.First(p => p.Skill.Name == SelectedItem.SelectedSkillRemove.Skill.Name); BasePoints.UsedPoints -= z.Cost; RemoveSkillCommand.OnCanExecuteChanged(); Skills.Remove(SelectedItem.SelectedSkillRemove); }, x => Scope.Resolve <ISelectedItem>().SelectedSkillRemove != null); AddAdvantageCommand = new DelegateCommand( x => { IActiveAdvantage z = Scope.Resolve <IActiveAdvantage>(); if (z.Advantage.PtPerLvl > BasePoints.UnspentPoints) { return; } Advantages.Add(z); BasePoints.UsedPoints += z.Advantage.PtPerLvl; AddAdvantageCommand.OnCanExecuteChanged(); }, x => AddAdvantageCanExecute() ); RemoveAdvantageCommand = new DelegateCommand( x => { var SelectedItem = Scope.Resolve <ISelectedItem>(); IActiveAdvantage z = Advantages.First(p => p.Advantage.Name == SelectedItem.SelectedAdvantageRemove.Advantage.Name); BasePoints.UsedPoints -= z.Cost; RemoveAdvantageCommand.OnCanExecuteChanged(); Advantages.Remove(SelectedItem.SelectedAdvantageRemove); }, x => Scope.Resolve <ISelectedItem>().SelectedAdvantageRemove != null ); AddDisadvantageCommand = new DelegateCommand( x => { IActiveDisadvantage z = Scope.Resolve <IActiveDisadvantage>(); if ((z.Disadvantage.PtCost + BasePoints.UsedDisadvantagePoints) < BasePoints.MaxDisadvantagePoints) { return; } Disadvantages.Add(z); BasePoints.UsedDisadvantagePoints += z.Disadvantage.PtCost; AddDisadvantageCommand.OnCanExecuteChanged(); }, x => AddDisadvantageCanExecute() ); RemoveDisadvantageCommand = new DelegateCommand( x => { var SelectedItem = Scope.Resolve <ISelectedItem>(); IActiveDisadvantage z = Disadvantages.First(p => p.Disadvantage.Name == SelectedItem.SelectedDisadvantageRemove.Disadvantage.Name); BasePoints.UsedDisadvantagePoints -= z.Cost; RemoveDisadvantageCommand.OnCanExecuteChanged(); Disadvantages.Remove(SelectedItem.SelectedDisadvantageRemove); }, x => Scope.Resolve <ISelectedItem>().SelectedDisadvantageRemove != null ); }
public static Result <VampireSheet, VampireSheetError> New(Guid id, Header header, Attributes attributes, Abilities abilities, Advantages advantages, Status status) { return(new VampireSheet(id, header, attributes, abilities, advantages, status)); }
private void btAddAdvantage_Click( object sender, RoutedEventArgs e ) { var findcontext = new Db1Entities(); var foundstat = ( from c in findcontext.Advantages where c.Name == TbName.Text select c ).FirstOrDefault(); findcontext.Dispose(); if (foundstat == null) { if (TbName.Text == "") { MessageBox.Show("Please input a Name for the Advantage!"); } else { using (var newcontext = new Db1Entities()) { var adv = new Advantages { isEnabled = CbisEnabled.IsChecked != null && (bool) CbisEnabled.IsChecked, isPhysical = CbisPhysical.IsChecked != null && (bool) CbisPhysical.IsChecked, isSocial = CbisSocial.IsChecked != null && (bool) CbisSocial.IsChecked, isSuperNatural = CbisSuperNatural.IsChecked != null && (bool) CbisSuperNatural.IsChecked, isExotic = CbisExotic.IsChecked != null && (bool) CbisExotic.IsChecked, isMundane = CbisMundane.IsChecked != null && (bool) CbisMundane.IsChecked, isMental = CbisMental.IsChecked != null && (bool) CbisMental.IsChecked, Limitation = TbLimitation.Text, Discription = TbDiscription.Text, PointCost = Convert.ToInt32(TbPointCost.Text), hasLevels = CbhasLevels.IsChecked != null && (bool) CbhasLevels.IsChecked, Name = TbName.Text, isCreationLocked = CbisCreationLocked.IsChecked != null && (bool) CbisCreationLocked.IsChecked, Reference = TbReference.Text }; newcontext.Advantages.Add(adv); newcontext.SaveChanges(); foreach (Modifier item in LbModifier.Items) { UsedModifier usedmod; _dictMod.TryGetValue(item, out usedmod); var firstOrDefault = ( from c in newcontext.Advantages where c.Name == adv.Name select c ).FirstOrDefault(); if (firstOrDefault != null) { if (usedmod != null) { usedmod.ForeignId = firstOrDefault.Id; } } newcontext.UsedModifier.Add(usedmod); newcontext.SaveChanges(); } } MessageBox.Show("'" + TbName.Text + "' added to the Database"); TbName.Text = ""; } } else { MessageBox.Show("That Advantage allready exists in the Database!"); } LoadStackPanelContent(); ClearControls(); }
public void Update(Advantages data) { _advantagesDal.Update(data); }
public void Add(Advantages data) { _advantagesDal.Add(data); }
private static string GetAdvType( Advantages item ) { var typelist = new List<string>(); if (item.isPhysical != null && (bool) item.isPhysical) { typelist.Add("Physical"); } if (item.isMental != null && (bool) item.isMental) { typelist.Add("Mental"); } if (item.isMundane != null && (bool) item.isMundane) { typelist.Add("Mundane"); } if (item.isExotic != null && (bool) item.isExotic) { typelist.Add("Exotic"); } if (item.isSocial != null && (bool) item.isSocial) { typelist.Add("Social"); } if (item.isSuperNatural != null && (bool) item.isSuperNatural) { typelist.Add("Super-Natural"); } var type = string.Join(",", typelist); return type; }
public void AddAdvantage(Advantage advantage) { Advantages.Add(advantage); advantage.Activate(this); }
private string GetRequirements( Advantages advitem ) { foreach (var item in _reqList.Where(item => item.SourceType == "Advantage").Where(item => item.SourceItemID == advitem.Id)) { return item.TargetName; } return ""; }
public void RemoveAdvantage(Advantage advantage) { Advantages.Remove(advantage); advantage.Deactivate(this); }
public bool AddAdvantageCanExecute() { return(!Advantages.Any(p => p.Advantage.Name == Scope.Resolve <ISelectedItem>().SelectedAdvantage?.Name)); }