Ejemplo n.º 1
0
        public ActionResult Edit(int id, Lookout lookout, int s, List <PreferredCompany> pc)
        {
            Lookout look = db.Lookouts.Find(id);

            lookout.LastActive = System.DateTime.Now;
            db.Entry(look).CurrentValues.SetValues(lookout);
            db.SaveChanges();
            //    WorkShift ws = new WorkShift();
            //      Shift sf = new Shift();
            //        sf = db.Shifts.Find(s);
            //          ws.Lookout_Id = look.Id;
            //            ws.Shift_Id = sf.id;
            WorkShift ws  = db.WorkShifts.FirstOrDefault(a => a.Lookout_Id == id);
            WorkShift wst = new WorkShift();
            Shift     sf  = new Shift();

            sf                 = db.Shifts.Find(s);
            ws.Shift_Id        = sf.id;
            db.Entry(ws).State = EntityState.Modified;
            db.SaveChanges();



            return(Json("", JsonRequestBehavior.AllowGet));
        }
        public ActionResult Delete(int id, int s)
        {
            Lookout          lookout = db.Lookouts.Find(id);
            List <WorkShift> ws      = db.WorkShifts.Where(a => a.Lookout_Id == lookout.Id).ToList();

            foreach (var lws in ws)
            {
                db.WorkShifts.Remove(lws);
                db.SaveChanges();
            }

            List <PreferredCompany> pc = db.PreferredCompanies.Where(b => b.Lookout_id == lookout.Id).ToList();

            foreach (var list in pc)
            {
                db.PreferredCompanies.Remove(list);
                db.SaveChanges();
            }

            List <PreferredLocation> prl = db.PreferredLocations.Where(ax => ax.Lookout_id == lookout.Id).ToList();

            foreach (var a in prl)
            {
                db.PreferredLocations.Remove(a);
                db.SaveChanges();
            }
            db.Lookouts.Remove(lookout);
            db.SaveChanges();
            return(Json("", JsonRequestBehavior.AllowGet));
        }
        private void onWatchtowerInteract(On.Celeste.Lookout.orig_Interact orig, Lookout self, Player player)
        {
            orig(self, player);

            // Pandora's Box seems to throw the player in the Dummy state 1 frame too early, so we got to flip the flag earlier as well. :a:
            UsingWatchtower = true;
        }
Ejemplo n.º 4
0
        private static void Lookout_Interact(On.Celeste.Lookout.orig_Interact orig, Lookout self, Player player)
        {
            orig(self, player);

            foreach (Player player2 in self.SceneAs <Level>().Tracker.GetEntities <Player>())
            {
                player2.StateMachine.State = Player.StDummy;
            }
        }
Ejemplo n.º 5
0
        private static void Lookout_Interact(On.Celeste.Lookout.orig_Interact orig, Lookout self, Player player)
        {
            orig(self, player);

            List <Entity> players = self.Scene.Tracker.GetEntities <Player>();

            closestLookoutPlayer = EntityHelper.GetClosestEntity(self, players) as Player;

            setPlayerState(players, closestLookoutPlayer, Player.StDummy);
        }
        public ActionResult Edit(int id, Lookout lookout, int s, List <PreferredCompany> pc, string locids)
        {
            string[] nameslist = locids.Split(',');
            lookout.LastActive      = System.DateTime.Now;
            db.Entry(lookout).State = EntityState.Modified;
            db.SaveChanges();
            WorkShift ws = db.WorkShifts.FirstOrDefault(a => a.Lookout_Id == id);
            Shift     sf = new Shift();

            sf                 = db.Shifts.Find(s);
            ws.Shift_Id        = sf.id;
            db.Entry(ws).State = System.Data.Entity.EntityState.Modified;  //EntityState.Modified;
            db.SaveChanges();
            foreach (var list in pc)
            {
                PreferredCompany pcs = db.PreferredCompanies.FirstOrDefault(a => a.Lookout_id == list.Lookout_id);
                db.Entry(pcs).CurrentValues.SetValues(pc);
                db.SaveChanges();
            }

            PreferredLocation        pr  = new PreferredLocation();
            List <PreferredLocation> prl = db.PreferredLocations.Where(ax => ax.Lookout_id == lookout.Id).ToList();

            foreach (var a in nameslist)
            {
                int      c   = Convert.ToInt16(a);
                Location loc = db.Locations.FirstOrDefault(ax => ax.City_id == c);
                //List<PreferredLocation> prl = db.PreferredLocations.Where(ax => ax.Lookout_id==lookout.Id).ToList();
                foreach (var lis in prl)
                {
                    db.PreferredLocations.Remove(lis);
                    db.SaveChanges();
                }
                var l = Convert.ToInt16(loc.id);
                pr.Location_id = l;
                pr.Lookout_id  = lookout.Id;
                db.PreferredLocations.Add(pr);
                db.SaveChanges();

                //    var l = Convert.ToInt16(loc.id);
                //    if (prl.Lookout_id == lookout.Id)
                //    {
                //        prl.Location_id=l;
                //        db.Entry(prl).CurrentValues.SetValues(nameslist);
                //        db.SaveChanges();
                //    }
            }

            return(Json("", JsonRequestBehavior.AllowGet));
        }
        // GET: Lookouts/Details/5
        public ActionResult Details(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            Lookout lookout = db.Lookouts.Find(id);

            if (lookout == null)
            {
                return(HttpNotFound());
            }
            return(View(lookout));
        }
Ejemplo n.º 8
0
        public ActionResult Delete(int id, int s)
        {
            Lookout   lookout = db.Lookouts.Find(id);
            WorkShift ws      = new WorkShift();

            if (ws.Lookout_Id == lookout.Id)
            {
                db.WorkShifts.Remove(ws);
                db.SaveChanges();
            }
            db.Lookouts.Remove(lookout);
            db.SaveChanges();

            return(Json("", JsonRequestBehavior.AllowGet));
        }
Ejemplo n.º 9
0
        // GET: Lookouts/Edit/5
        public ActionResult Edit(int id)
        {
            JobPortalViewModel vm = new JobPortalViewModel();
            var userlist          = new SelectList(db.UserDetails, "ID", "UserName");

            ViewData["userlist"] = userlist;
            var shiftlist = new SelectList(db.Shifts, "id", "ShiftName");

            ViewData["shiflist"] = shiftlist;

            Lookout lookout = db.Lookouts.Find(id);

            lookout.LastActive = System.DateTime.Now;
            vm.lookout         = lookout;
            return(View(vm));
        }
        public ActionResult Create(Lookout lookout, int s, List <PreferredCompany> pc, string lkid)
        {
            string[] nameslist = lkid.Split(',');

            lookout.LastActive = System.DateTime.Now;

            db.Lookouts.Add(lookout);
            db.SaveChanges();
            foreach (var list in pc)
            {
                list.Lookout_id = lookout.Id;
                db.PreferredCompanies.Add(list);
                db.SaveChanges();
            }
            PreferredLocation prl = new PreferredLocation();

            foreach (var a in nameslist)
            {
                int      c   = Convert.ToInt16(a);
                Location loc = db.Locations.FirstOrDefault(ax => ax.City_id == c);
                var      l   = Convert.ToInt16(loc.id);
                prl.Location_id = l;
                prl.Lookout_id  = lookout.Id;
                db.PreferredLocations.Add(prl);
                db.SaveChanges();
            }

            WorkShift ws    = new WorkShift();
            Shift     shift = db.Shifts.Find(s);

            ws.Shift_Id   = shift.id;
            ws.Lookout_Id = lookout.Id;
            db.WorkShifts.Add(ws);
            db.SaveChanges();
            return(Json("", JsonRequestBehavior.AllowGet));
        }
        private IEnumerator onWatchtowerUse(On.Celeste.Lookout.orig_LookRoutine orig, Lookout self, Player player)
        {
            UsingWatchtower = true;
            float timeStartedUsing = Engine.Scene.TimeActive;

            yield return(new SwapImmediately(orig(self, player)));

            UsingWatchtower = false;

            if (Settings.BadelineChasersEverywhere)
            {
                // adjust chaser state timestamps so that they behave as if the player didn't stand by that watchtower.
                float timeDiff = Engine.Scene.TimeActive - timeStartedUsing;
                for (int i = 0; i < player.ChaserStates.Count; i++)
                {
                    // structs are nice. I have to copy it, modify it, then place it back.
                    Player.ChaserState state = player.ChaserStates[i];
                    state.TimeStamp       += timeDiff;
                    player.ChaserStates[i] = state;
                }
            }
        }
Ejemplo n.º 12
0
        private static void Lookout_StopInteracting(On.Celeste.Lookout.orig_StopInteracting orig, Lookout self)
        {
            orig(self);

            foreach (Player player2 in self.SceneAs <Level>().Tracker.GetEntities <Player>())
            {
                player2.StateMachine.State = Player.StNormal;
            }
        }
Ejemplo n.º 13
0
        private static IEnumerator Lookout_LookRoutine(On.Celeste.Lookout.orig_LookRoutine orig, Lookout self, Player player)
        {
            List <Entity> players = self.SceneAs <Level>().Tracker.GetEntities <Player>();
            Entity        closest = EntityHelper.GetClosestEntity(self, players);

            setPlayerState(players, closest, Player.StDummy);

            yield return(orig(self, closest as Player));

            setPlayerState(players, closest, Player.StNormal);
        }
Ejemplo n.º 14
0
        private static IEnumerator LookRoutine(On.Celeste.Lookout.orig_LookRoutine orig, Lookout self, Player player)
        {
            SteamWall steamWall = self.Scene.Tracker.GetEntity <SteamWall>();

            if (steamWall != null)
            {
                steamWall.Halted = true;
            }
            yield return(orig(self, player));

            if (steamWall != null)
            {
                steamWall.Halted = false;
            }
        }
        // GET: Lookouts/Delete/5
        public ActionResult Delete(int id)
        {
            Lookout lookout = db.Lookouts.Find(id);

            return(View());
        }
Ejemplo n.º 16
0
        // Methods
        private static string GetResult(Role role)
        {
            switch (role)
            {
            case Investigator _: return($"{role.Owner.Data.PlayerName} gathers information about people. They must be an {Investigator.GetName()}.");

            case Lookout _: return($"{role.Owner.Data.PlayerName} watches who visits people at night. They must be a {Lookout.GetName()}.");

            case Psychic _: return($"{role.Owner.Data.PlayerName} has the sight. They must be a {Psychic.GetName()}.");

            case Sheriff _: return($"{role.Owner.Data.PlayerName} is a protector of the {Faction.Crew.Name}. They must be a {Sheriff.GetName()}.");

            case Spy _: return($"{role.Owner.Data.PlayerName} secretly watches who someone visits. They must be a {Spy.GetName()}.");

            case Tracker _: return($"{role.Owner.Data.PlayerName} is a skilled in the art of tracking. They must be a {Tracker.GetName()}.");

            case Jailor _:        return($"{role.Owner.Data.PlayerName} detains people at night. They must be a {Jailor.GetName()}.");

            case VampireHunter _: return($"{role.Owner.Data.PlayerName} tracks Vampires. They must be a {VampireHunter.GetName()}!");

            case Veteran _:       return($"{role.Owner.Data.PlayerName} is a paranoid war hero. They must be a {Veteran.GetName()}.");

            case Vigilante _: return($"{role.Owner.Data.PlayerName} will bend the law to enact justice. They must be a {Vigilante.GetName()}.");

            case Bodyguard _: return($"{role.Owner.Data.PlayerName} is a trained protector. They must be a {Bodyguard.GetName()}.");

            case Doctor _:    return($"{role.Owner.Data.PlayerName} is a professional surgeon. They must be a {Doctor.GetName()}.");

            case Crusader _:  return($"{role.Owner.Data.PlayerName} is a divine protector. They must be a {Crusader.GetName()}.");

            case Trapper _:   return($"{role.Owner.Data.PlayerName} is waiting for a big catch. They must be a {Trapper.GetName()}.");

            case Escort _: return($"{role.Owner.Data.PlayerName} is a beautiful person working for the {Faction.Crew.Name}. They must be an {Escort.GetName()}.");

            case Mayor _: return($"{role.Owner.Data.PlayerName} is the leader of the {Faction.Crew.Name}. They must be the {Mayor.GetName()}.");

            case Medium _: return($"{role.Owner.Data.PlayerName} speaks with the dead. They must be a {Medium.GetName()}.");

            case Retributionist _: return($"{role.Owner.Data.PlayerName} wields mystical powers. They must be a {Retributionist.GetName()}.");

            case Transporter _: return($"{role.Owner.Data.PlayerName} specializes in transportation. They must be a {Transporter.GetName()}.");

            case Disguiser _: return($"{role.Owner.Data.PlayerName} makes other people appear to be someone they're not. They must be a {Disguiser.GetName()}");

            case Forger _: return($"{role.Owner.Data.PlayerName} is good at forging documents. They must be a {Forger.GetName()}.");

            case Framer _: return($"{role.Owner.Data.PlayerName} has a desire to deceive. They must be a {Framer.GetName()}!");

            case Hypnotist _: return($"{role.Owner.Data.PlayerName} is skilled at disrupting others. They must be a {Hypnotist.GetName()}.");

            case Janitor _: return($"{role.Owner.Data.PlayerName} cleans up dead bodies. They must be a {Janitor.GetName()}.");

            case Ambusher _: return($"{role.Owner.Data.PlayerName} lies in wait. They must be an {Ambusher.GetName()}.");

            case Godfather _: return($"{role.Owner.Data.PlayerName} is the leader of the {Faction.Mafia.Name}. They must be the {Godfather.GetName()}.");

            case Mafioso _: return($"{role.Owner.Data.PlayerName} does the {Godfather.GetName()}'s dirty work. They must be a {Mafioso.GetName()}.");

            case Blackmailer _: return($"{role.Owner.Data.PlayerName} uses information to silence people. They must be a {Blackmailer.GetName()}.");

            case Consigliere _: return($"{role.Owner.Data.PlayerName} gathers information for the {Faction.Mafia.Name}. They must be a {Consigliere.GetName()}.");

            case Consort _: return($"{role.Owner.Data.PlayerName} is a beautiful person working for the {Faction.Mafia.Name}. They must be a {Consort.GetName()}.");

            case Amnesiac _: return($"{role.Owner.Data.PlayerName} does not remember their role. They must be an {Amnesiac.GetName()}.");

            case GuardianAngel _: return($"{role.Owner.Data.PlayerName} is watching over someone. They must be a {GuardianAngel.GetName()}.");

            case Survivor _: return($"{role.Owner.Data.PlayerName} simply wants to live. They must be a {Survivor.GetName()}.");

            case Vampire _: return($"{role.Owner.Data.PlayerName} drinks blood. They must be a {Vampire.GetName()}!");

            case Executioner _: return($"{role.Owner.Data.PlayerName} wants someone to be lynched at any cost. They must be an {Executioner.GetName()}.");

            case Jester _: return($"{role.Owner.Data.PlayerName} wants to be lynched. They must be a {Jester.GetName()}.");

            case Witch _:  return($"{role.Owner.Data.PlayerName} casts spells on people. They must be a {Witch.GetName()}.");

            case Arsonist _: return($"{role.Owner.Data.PlayerName} likes to watch things burn. They must be an {Arsonist.GetName()}.");

            case SerialKiller _: return($"{role.Owner.Data.PlayerName} wants to kill everyone. They must be a {SerialKiller.GetName()}");

            case Werewolf _: return($"{role.Owner.Data.PlayerName} howls at the moon. They must be a {Werewolf.GetName()}.");

            default: return("No special role found.");
            }
        }
Ejemplo n.º 17
0
        private static IEnumerator Lookout_LookRoutine(On.Celeste.Lookout.orig_LookRoutine orig, Lookout self, Player player)
        {
            List <Entity> players = self.SceneAs <Level>().Tracker.GetEntities <Player>();

            setPlayerState(players, closestLookoutPlayer, Player.StDummy);

            IEnumerator origEnumerator = orig(self, closestLookoutPlayer);

            while (origEnumerator.MoveNext())
            {
                yield return(origEnumerator.Current);
            }

            setPlayerState(players, closestLookoutPlayer, Player.StNormal);
        }
Ejemplo n.º 18
0
        // Methods
        private static IEnumerable <string> GetResults(Role role)
        {
            switch (role)
            {
            case Vigilante _:
            case Veteran _:
            case Mafioso _:
            // case Pirate _:
            case Ambusher _:
                return(new[] { Vigilante.GetName(), Veteran.GetName(), Mafioso.GetName(), Ambusher.GetName() });

            case Medium _:
            case Janitor _:
            case Retributionist _:
            // case Necromancer _:
            case Trapper _:
                return(new[] { Medium.GetName(), Janitor.GetName(), Retributionist.GetName(), Trapper.GetName() });

            case Survivor _:
            case VampireHunter _:
            case Amnesiac _:
            // case Medusa _:
            case Psychic _:
                return(new[] { Survivor.GetName(), VampireHunter.GetName(), Amnesiac.GetName(), Psychic.GetName() });

            case Spy _:
            case Blackmailer _:
            case Jailor _:
            case GuardianAngel _:
                return(new[] { Spy.GetName(), Blackmailer.GetName(), Jailor.GetName(), GuardianAngel.GetName() });

            case Sheriff _:
            case Executioner _:
            case Werewolf _:
                // case Poisoner _:
                return(new[] { Sheriff.GetName(), Executioner.GetName(), Werewolf.GetName() });

            case Framer _:
            case Vampire _:
            case Jester _:
                // case HexMaster _:
                return(new[] { Framer.GetName(), Vampire.GetName(), Jester.GetName() });

            case Lookout _:
            case Forger _:
                // case Juggernaut _:
                // case CovenLeader _:
                return(new[] { Lookout.GetName(), Forger.GetName() });

            case Escort _:
            case Transporter _:
            case Consort _:
            case Hypnotist _:
                return(new[] { Escort.GetName(), Transporter.GetName(), Consort.GetName(), Hypnotist.GetName() });

            case Doctor _:
            case Disguiser _:
            case SerialKiller _:
                // case PotionMaster _:
                return(new[] { Doctor.GetName(), Disguiser.GetName(), SerialKiller.GetName() });

            case Investigator _:
            case Consigliere _:
            case Mayor _:
            case Tracker _:
                // case Plaguebearer _:
                return(new[] { Investigator.GetName(), Consigliere.GetName(), Mayor.GetName(), Tracker.GetName() });

            case Bodyguard _:
            case Godfather _:
            case Arsonist _:
            case Crusader _:
                return(new[] { Bodyguard.GetName(), Godfather.GetName(), Arsonist.GetName(), Crusader.GetName() });
            }

            return(new string[] { });
        }