Exemple #1
0
        public ActionResult Create(NpcViewModel npc)
        {
            var anpc = new AbstractNpc(npc);

            if (npc.IsMinion)
            {
                anpc.Type = NpcType.Minion;
            }
            else if (npc.IsToughend)
            {
                anpc.Type = NpcType.Toughend;
            }
            else
            {
                anpc.Type = NpcType.Nemesis;
            }


            if (ModelState.IsValid)
            {
                db.Npcs.Add(npc);
                db.SaveChanges();
                return(RedirectToAction("Index"));
            }

            return(View(npc));
        }
Exemple #2
0
        public ActionResult DeleteConfirmed(int id)
        {
            AbstractNpc npc = db.Npcs.Find(id);

            db.Npcs.Remove(npc);
            db.SaveChanges();
            return(RedirectToAction("Index"));
        }
Exemple #3
0
 public ActionResult Edit([Bind(Include = "ID,Name,Awareness,Intelligence,Personality,Agility,Brawn,Willpower,Coordination,Combat,Movement,Fortitude,Senses,Knowledge,Social")] AbstractNpc npc)
 {
     if (ModelState.IsValid)
     {
         db.Entry(npc).State = EntityState.Modified;
         db.SaveChanges();
         return(RedirectToAction("Index"));
     }
     return(View(npc));
 }
Exemple #4
0
        // GET: Npc/Edit/5
        public ActionResult Edit(int?id)
        {
            if (id == null)
            {
                return(new HttpStatusCodeResult(HttpStatusCode.BadRequest));
            }
            AbstractNpc npc = db.Npcs.Find(id);

            if (npc == null)
            {
                return(HttpNotFound());
            }
            return(View(npc));
        }
Exemple #5
0
        // GET: Npc/Create
        public ActionResult Create()
        {
            var npc = new AbstractNpc
            {
                Agility      = 9,
                Awareness    = 9,
                Brawn        = 9,
                Coordination = 9,
                Personality  = 9,
                Willpower    = 9,
                Intelligence = 9,
                Type         = NpcType.Toughend,
                Combat       = 0,
                Fortitude    = 0,
                Movement     = 0,
                Knowledge    = 0,
                Senses       = 0,
                Social       = 0,
                Name         = "Next Victim"
            };

            return(View(new NpcViewModel(npc)));
        }
        public NpcViewModel(AbstractNpc npc) : base(npc)
        {
            IsMinion   = false;
            IsNemesis  = false;
            IsToughend = false;

            switch (npc.Type)
            {
            case NpcType.Minion:
                IsMinion = true;
                break;

            case NpcType.Toughend:
                IsToughend = true;
                break;

            case NpcType.Nemesis:
                IsNemesis = true;
                break;

            default:
                break;
            }
        }