public Goal OutOfGoalViewModel(GoalViewModel goalViewModel, string username) { Sports sports = new Sports(SessionProvider.CurrentSession); Venues venues = new Venues(SessionProvider.CurrentSession); Goals goals = new Goals(SessionProvider.CurrentSession); Users users = new Users(SessionProvider.CurrentSession); Goal goal; if(goalViewModel.Id == 0) { goal = new Goal(); goal.CreatedOn = DateTime.Now; goal.UserCreator = users.GetByUserName(username); } else { goal = goals.GetById(goalViewModel.Id); } goal.Name = goalViewModel.Name; goal.Date = goalViewModel.Date; goal.Description = goalViewModel.Description; goal.Web = goalViewModel.Web; goal.Venue = venues.GetById(Convert.ToInt32(goalViewModel.VenueId)); goal.Sport = sports.GetById(Convert.ToInt32(goalViewModel.SportId)); goal.Venue.Latitude = Convert.ToInt32(goalViewModel.VenueLatitude); goal.Venue.Longitude = Convert.ToInt32(goalViewModel.VenueLongitude); return goal; }
public ActionResult Create_(Goal goal) { // This method is casting the values from the form and validating the state. // However, since there are some fiels as of now that we are still not adding, // the validate state is failing. We have workarounds to add the missing values // and validate the state. The issue is that we wont know anymore if // there was some legit error coming from the site. var goals = new Goals(SessionProvider.CurrentSession); var anyGoal = goals.GetAll().First(); goal.CreatedOn = DateTime.Now; goal.Venue = anyGoal.Venue; goal.Sport = anyGoal.Sport; goal.UserCreator = anyGoal.UserCreator; ModelState.Where(m => m.Value.Errors != null).ToList().ForEach(e => { var error = e.Value.Errors; error.Clear(); }); UpdateModel(goal); if (ModelState.IsValid) { goals.Add(goal); return RedirectToAction("Details", new { Id = goal.Id }); } GoalViewModel goalViewModel = AutoMapper.Mapper.Map<Goal, GoalViewModel>(goal); return View(goalViewModel); }
private void Initialize() { countries = new Countries(session); cities = new Cities(session); venues = new Venues(session); users = new Users(session); sports = new Sports(session); goals = new Goals(session); }
private void Awake() { identifier = 0; QuestName = "Collect Fishing Equipment"; Description = "Get the fishing equipment and return it."; ExperienceReward = 50; Goals.Add(new CollectGoal(this, 0, "Find the fishing rod.", false, 0, 0, Goal.type.collect)); Goals.ForEach(g => g.Init()); }
private void Awake() { identifier = 1; QuestName = "Kill Bandits"; Description = "Defeat bandits that are harrassing the village."; ExperienceReward = 50; Goals.Add(new KillGoal(this, 0, "Kill 5 bandits", false, 0, 5, Goal.type.kill)); Goals.ForEach(g => g.Init()); }
public async Task <IActionResult> PostGoals([FromBody] Goals goals) { if (!ModelState.IsValid) { return(BadRequest(ModelState)); } _context.Goals.Add(goals); await _context.SaveChangesAsync(); return(CreatedAtAction("GetGoals", new { id = goals.GoalId }, goals)); }
private void populateCommentsTable() { try { Goals gi = new Goals(Request.QueryString["id"].ToString()); divComments.InnerHtml = gi.populateCommentsTable(); } catch (Exception ex) { divComments.InnerHtml = "An Error Occurred: " + ex.ToString(); } }
private void ExcecuteDeleteGoal() { foreach (var goal in Goals) { goal.RelatesGoals.Remove(SelectedGoal.Id); } Goals.Single(x => x.Id == SelectedGoal.Id).Deleted = true; _repo.SaveGoals(Goals); UpdateGoals(); UpdateCanvas(); }
/// <summary> /// Call when two players have joined the game /// </summary> private void Start() { Debug.Log("[Ball Controller] Initialising..."); isGoal = false; var p1Goal = Goals.FindPlayerOneGoal().GetComponent <TriggerObservable>(); var p2Goal = Goals.FindPlayerTwoGoal().GetComponent <TriggerObservable>(); p1Goal.TriggerEnter += OnGoal; p2Goal.TriggerEnter += OnGoal; GameServer.OnGameReady += CreateBall; }
private void ExcecuteAddNewGoal() { var newGoal = new Goal(); newGoal.Id = _idService.GetFreeId(Goals); newGoal.Name = NewGoalName; newGoal.GoalType = NewGoalType; Goals.Add(newGoal); _repo.SaveGoals(Goals); Goals = _repo.GetAllGoals(); NewGoalName = ""; }
private void Start() { QuestName = "Potion Collector"; QuestDescription = "Collect health and stamina potions to prepare yourself for the journey ahead."; ExperienceReward = 2500; GoldReward = 100; ItemReward = FindItem("Tutorial Sheild +1"); Goals.Add(new CollectionGoal(this, "Health Potion", 2)); Goals.Add(new CollectionGoal(this, "Stamina Potion", 2)); Goals.ForEach(goal => goal.Initialise()); }
private void Start() { QuestName = "Slime Slayer"; Description = "Kill 3 slimes"; ItemReward = ItemDatabase.Instance.GetItem("potion_log"); ExperienceReward = 100; Goals.Add(new KillGoal(this, 0, "Kill 3 Slimes", false, 0, 3)); Goals.Add(new CollectionGoal(this, "sword", "Find the guards sword.", false, 0, 1)); Goals.ForEach(g => g.Init()); }
void Start() { QuestName = "Herb Collection"; Description = "Retrieve 4 Wolfs Bane Herbs For The Chemist"; questType = QuestType.Collecting; Goals.Add(new CollectionGoal(this, 5, "Gather Three Wolfs Bane Herbs For The Chemist", false, 0, 3)); ItemReward = "Mega Health Potion"; ItemReward2 = "Mega Health Potion"; ItemReward3 = "Mega Mana Potion"; Goals.ForEach(g => g.Init()); }
void Start() { QuestName = "Slayer Quest 2"; Description = "A Horde Of Monsters Must Be Defeated"; questType = QuestType.Killing; ItemReward = "Mana Potion"; Goals.Add(new KillGoal(this, 0, "Kill The Horde Of Skeleton Knights", false, 0, 4)); Goals.Add(new KillGoal(this, 1, "Kill The Necromancer ", false, 0, 1)); Goals.ForEach(g => g.Init()); }
void Start() { QuestName = "" + "Search for Death's Fruit for Max"; Description = "Give Max a Death's fruit."; ItemReward = ItemDatabase.Instance.GetItem("GoblinAxe"); ExperienceReward = 100; Goals.Add(new CollectGoal(this, "DeathsFruit", Description, false, 0, 1)); Goals.ForEach(g => g.Init()); }
void Start() { // Name of the quest has to be the same as the class name QuestName = "CollectSnowflakeQuestEasy"; // InGame description Description = "Collect 3 snowflakes"; Reward = new ItemReward(100); // Add the goals to the list Goals.Add(new CollectGoal(1, "Collect 3 snowflakes", false, 0, 3)); Goals.ForEach(g => g.Init()); }
void Start() { // Name of the quest has to be the same as the class name QuestName = "TotalDistanceQuestHard"; // InGame description Description = "Reach a total distance of 1600 blocks"; Reward = new ItemReward(800); // Add the goals to the list Goals.Add(new TotalDistanceGoal("Reach a total distance of 1600 blocks", false, 0, 1600)); Goals.ForEach(g => g.Init()); }
void Start() { QuestName = "Ultimate Slayer"; Description = "Kill a bunch of stuff."; ItemReward = ItemDatabase.Instance.GetItem("potion_log"); ExperienceReward = 100; Goals.Add(new KillGoal(0, "Kill 5 Slimes", false, 0, 5)); Goals.Add(new KillGoal(1, "Kill 2 Vampires", false, 0, 2)); Goals.ForEach(g => g.Init()); }
public IActionResult Delete(int id) { Goals Goals = _context.Goals.Single(g => g.GoalsId == id); if (User == null) { return(NotFound()); } _context.Goals.Remove(Goals); _context.SaveChanges(); return(Ok(User)); }
public Embed GetEmbed() { bool firstFieldInline = Roles.Count() + Descriptors.Count() + Goals.Count() <= 3; List <EmbedFieldBuilder> rolesField = new List <EmbedFieldBuilder>(); for (int i = 0; i < Roles.Length; i++) { if (i == 0) { rolesField.Add(new EmbedFieldBuilder().WithIsInline(firstFieldInline).WithName(NPCResources.Role).WithValue(Roles[i])); } else { rolesField.Add(new EmbedFieldBuilder().WithIsInline(true).WithName(NPCResources.Role).WithValue(Roles[i])); } } List <EmbedFieldBuilder> goalFields = new List <EmbedFieldBuilder>(); for (int i = 0; i < Goals.Length; i++) { if (i == 0) { goalFields.Add(new EmbedFieldBuilder().WithIsInline(firstFieldInline).WithName(NPCResources.Goal).WithValue(Goals[i])); } else { goalFields.Add(new EmbedFieldBuilder().WithIsInline(true).WithName(NPCResources.Goal).WithValue(Goals[i])); } } List <EmbedFieldBuilder> descFields = new List <EmbedFieldBuilder>(); for (int i = 0; i < Descriptors.Length; i++) { if (i == 0) { descFields.Add(new EmbedFieldBuilder().WithIsInline(firstFieldInline).WithName(NPCResources.Descriptor).WithValue(Descriptors[i])); } else { descFields.Add(new EmbedFieldBuilder().WithIsInline(true).WithName(NPCResources.Descriptor).WithValue(Descriptors[i])); } } return(new EmbedBuilder() .WithTitle($"__{NPCResources.NPC}__") .WithFields(new EmbedFieldBuilder().WithName(NPCResources.Name).WithValue(Name).WithIsInline(false)) .WithFields(rolesField) .WithFields(goalFields) .WithFields(descFields) .Build()); }
void Start() { QuestName = "" + "Get a Bottle of unicorn blood for Borg."; Description = "Borg desires a Bottle of unicorn blood, give him one."; ItemReward = ItemDatabase.Instance.GetItem("DeathsFruit"); ExperienceReward = 100; Goals.Add(new CollectGoal(this, "BottleOfUnicornBlood", Description, false, 0, 1)); Goals.ForEach(g => g.Init()); }
Messages.SuggestAction IToBase <Messages.SuggestAction> .ToBase() { return(new Messages.SuggestAction() { gameId = GameId, GoalFields = Goals?.Select(q => q.ToBase()).ToArray(), playerGuid = PlayerGUID, playerId = PlayerId, senderPlayerId = SenderPlayerId, TaskFields = Tasks?.Select(q => q.ToBase()).ToArray() }); }
void Start() { // Name of the quest has to be the same as the class name QuestName = "IceSnapQuestEasy"; // InGame description Description = "Snap 40 ice blocks"; Reward = new ItemReward(150); // Add the goals to the list Goals.Add(new IceSnapGoal("Snap 40 ice blocks", false, 0, 40)); Goals.ForEach(g => g.Init()); }
void Start() { // Name of the quest has to be the same as the class name QuestName = "PlayGamesQuestHard"; // InGame description Description = "Play 5 game"; Reward = new ItemReward(500); // Add the goals to the list Goals.Add(new GamePlayedGoal("Play 5 Game", false, 0, 5)); Goals.ForEach(g => g.Init()); }
void Start() { QuestName = "" + "Ghost Slayer"; Description = "Kill 5 ghosts"; ItemReward = ItemDatabase.Instance.GetItem("BottleOfUnicornBlood"); ExperienceReward = 100; Goals.Add(new KillGoal(this, 1, Description, false, 0, 5)); Goals.ForEach(g => g.Init()); }
public ActionResult Unsubscribe([Bind(Prefix = "id")] int goalId) { var goals = new Goals(SessionProvider.CurrentSession); var goal = goals.GetById(goalId); var goalParticipant = goal.Participants.Single(s => s.User.Username == User.Identity.Name); goal.Participants.Remove(goalParticipant); return View("MembershipWidget", new MembershipManagementViewModel(false, goalId)); }
void Start() { // Name of the quest has to be the same as the class name QuestName = "CollectFishQuestEasy"; // InGame description Description = "Collect 25 fish"; Reward = new ItemReward(100); // Add the goals to the list Goals.Add(new CollectGoal(0, "Collect 25 fish", false, 0, 25)); Goals.ForEach(g => g.Init()); }
void Start() { // Name of the quest has to be the same as the class name QuestName = "DistanceQuestEasy"; // InGame description Description = "Reach a distance of 60 blocks"; Reward = new ItemReward(100); // Add the goals to the list Goals.Add(new DistanceGoal("Reach a distance of 60 blocks", false, 0, 60)); Goals.ForEach(g => g.Init()); }
// Start is called before the first frame update void Start() { QuestName = "Talk to Chad"; Description = "Meet chad and interact with him"; reward = 20; //questTitle.text = "Talk to Chad"; //questDescription.text = "Meet chad and interact with him"; Goals.Add(new QuestGoal(this, 0, "meet chad", false, 0, 1)); Goals.ForEach(g => g.Init()); }
// Traverses the graph of goals to find the next list of goals private List <Goal> TraverseGoalGraph(string nextGoalID, Dictionary <string, object> entityValues, List <Response> responses) { List <Goal> goalList = new List <Goal>(); Goal currentGoal; bool canTraverse = true; while (canTraverse) { currentGoal = Goals.Find(x => x.ID == nextGoalID); if (!currentGoal.IsActive(entityValues) || currentGoal.IsAchieved(Goals, entityValues, responses)) { nextGoalID = currentGoal.ParentID; continue; } if (currentGoal.GetType() == typeof(CompositeGoal)) { if (((CompositeGoal)currentGoal).DoSkip(Goals, entityValues, responses)) { foreach (string subgoalID in ((CompositeGoal)currentGoal).SubgoalIDs) { Goal subgoal = Goals.Find(x => x.ID == subgoalID); if (subgoal.IsActive(entityValues) && !subgoal.IsAchieved(Goals, entityValues, responses)) { nextGoalID = subgoalID; break; } } } else { goalList.Add(currentGoal); canTraverse = false; } } else if (currentGoal.GetType() == typeof(AtomicInformativeGoal)) { goalList.Add(currentGoal); canTraverse = ((AtomicInformativeGoal)currentGoal).DoContinue; // If DoConitnue == True, then will continue traversing graph. Otherwise it will stop. } else { goalList.Add(currentGoal); canTraverse = false; } } return(goalList); }
public ActionResult Feedback(Goals goal) { var g = db.Goals.Find(goal.Id); g.MentorFeedback = goal.MentorFeedback; db.Entry(g).State = EntityState.Modified; db.SaveChanges(); // Type options : info, danger, success, warning TempData["UserMessage"] = new JavaScriptSerializer().Serialize(new { Type = "success", Title = "Success!", Message = "Feedback added correctly!" }); return(View(g)); }
public Data ToBase() { return(new Data() { gameFinished = GameFinished, Pieces = Pieces?.Where(q => q != null).Select(q => q.ToBase()).ToArray(), playerGuid = PlayerGUID, playerId = PlayerId, PlayerLocation = PlayerLocation?.ToBase(), TaskFields = Tasks?.Where(q => q != null).Select(q => q.ToBase()).ToArray(), GoalFields = Goals?.Where(q => q != null).Select(q => q.ToBase()).ToArray() }); }
public ActionResult Create([Bind(Include = "GoalDescription,TotalCost")] Goals goals, string Date, string Month, string Year) { if (ModelState.IsValid) { goals.UserName = User.Identity.Name; goals.AchievementDate = new DateTime(int.Parse(Year), int.Parse(Month), int.Parse(Date)).Date; db.Goals.Add(goals); db.SaveChanges(); return(RedirectToAction("Index", "Budget")); } return(View(goals)); }
/// <summary> /// retrieves a list of the Google Analtyics Goals /// </summary> /// <param name="service">AnalyticsService</param> /// <param name="pAccount">The account we would like to request propertys for</param> /// <param name="pWebProperty">Webproprty we are selecting for </param> /// <param name="pProfile"> profile we are selecting for </param> /// <returns></returns> public static Goals GoalList(AnalyticsService service, string pAccount, string pWebProperty, string pProfile) { ManagementResource.GoalsResource.ListRequest request = service.Management.Goals.List(pAccount, pWebProperty, pProfile); try { Goals result = request.Execute(); return(result); } catch (Exception) { return(null); } }
public ActionResult SubscriptionStatus(int goalId) { var goals = new Goals(SessionProvider.CurrentSession); var users = new Users(SessionProvider.CurrentSession); var goal = goals.GetById(goalId); var user = users.GetByUserName(User.Identity.Name); if(goal.IsParticipant(user.Username)) { return View("MembershipWidget", new MembershipManagementViewModel(true, goalId)); } return View("MembershipWidget", new MembershipManagementViewModel(false, goalId)); }
public void html([Bind(Prefix = "id")] string name) { Goals goals = new Goals(SessionProvider.CurrentSession); Sports sports = new Sports(SessionProvider.CurrentSession); var goalList = goals.GetAllBySport(sports.GetByName(name)); string html = "<ul>"; foreach (Goal goal in goalList) { html += string.Format("<li> -Name: {0} <br/>-Description: {1}</li>", goal.Name, goal.Description); } html += "</ul>"; Response.Write(html); }
public ActionResult Edit_(Goal viewModelGoal) { // This would be the manual process, using the update hard coded. // Better use the UpdateModel integrated in the framework! UpdateModel(viewModelGoal); var goals = new Goals(SessionProvider.CurrentSession); var currentGoal = goals.GetById(viewModelGoal.Id); currentGoal.Description = viewModelGoal.Description; currentGoal.Name = viewModelGoal.Name; currentGoal.Web = viewModelGoal.Web; goals.Update(currentGoal); return RedirectToAction("Details", new { Id = currentGoal.Id }); }
private void Initialize() { InitalizeSessionFactory( typeof (Country).Assembly, typeof (Goal).Assembly, typeof (User).Assembly, typeof (Venue).Assembly, typeof (Country).Assembly, typeof (Sport).Assembly); countries = new Countries(session); cities = new Cities(session); venues = new Venues(session); users = new Users(session); sports = new Sports(session); goals = new Goals(session); goalParticipants = new GoalParticipants(session); }
public ActionResult Create(Goals goals) { if (ModelState.IsValid) { int id; SequenceController.getGoalsSequence(); id = SequenceController._GoalSequenceid; goals.Goalid = id; string status = Request.Form["lststatus"].ToString(); goals.Goalstatus = status; db.Goals.Add(goals); db.SaveChanges(); SequenceController.setGoalsSequence(); return RedirectToAction("Index"); } return View(goals); }
public ActionResult Subscribe([Bind(Prefix = "id")] int goalId) { var goals = new Goals(SessionProvider.CurrentSession); var goal = goals.GetById(goalId); var users = new Users(SessionProvider.CurrentSession); var user = users.GetByUserName(User.Identity.Name); goal.Participants.Add(new GoalParticipant() { Goal = goal, User = user, SignedOnDate = DateTime.Now }); return View("MembershipWidget", new MembershipManagementViewModel(true, goalId)); }
public ActionResult index_json() { // http://localhost/endurancegoals/goals Goals goals = new Goals(SessionProvider.OpenSession()); var goalList = goals.GetAll(); var jsonGoals = JsonBuilder.BuildJsonGoal(goalList); return Json(new { success = jsonGoals }, JsonRequestBehavior.AllowGet); }
public ActionResult JsonSport([Bind(Prefix = "id")] string name) { Goals goals = new Goals(SessionProvider.CurrentSession); Sports sports = new Sports(SessionProvider.CurrentSession); var goalList = goals.GetAllBySport(sports.GetByName(name)); var jsonGoals = JsonBuilder.BuildJsonGoal(goalList); return Json(new { success = jsonGoals }, JsonRequestBehavior.AllowGet); }
private void SetGoal(Goals.Goal g) { Debug.Log ("Changing goal to " + g); goal = g; }
public ActionResult JsonList() { Goals goals = new Goals(SessionProvider.OpenSession()); var goalList = goals.GetAll(); var jsonGoals = JsonBuilder.BuildJsonGoal(goalList); return Json(new { success = jsonGoals }, JsonRequestBehavior.AllowGet); }
public ActionResult Edit(Goals goals) { if (ModelState.IsValid) { db.Entry(goals).State = EntityState.Modified; string status = Request.Form["lststatus"].ToString(); goals.Goalstatus = status; db.SaveChanges(); return RedirectToAction("Index"); } return View(goals); }