示例#1
0
文件: Copie.cs 项目: Zilmerx/Temrael2
        public static void Aggro_OnTarget(Mobile from, object targ)
        {
            if (from is PlayerMobile)
            {
                PlayerMobile pm = (PlayerMobile)from;

                /*if (pm.GetAptitudeValue(Aptitude.Protection) < 5)
                 *  from.SendMessage("Vous devez pouvoir utiliser le sort Copie.");*/
                if (targ is Copie)
                {
                    Copie target = (Copie)targ;

                    if (target != null && target.SummonMaster == pm)
                    {
                        if (target.Aggro)
                        {
                            target.Aggro = false;
                        }
                        else
                        {
                            target.Aggro = true;
                        }
                    }
                }
                else
                {
                    from.SendMessage("Vous devez cibler une copie.");
                }
            }
        }
示例#2
0
        public IHttpActionResult PostCopie(Copie copie)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            db.Copies.Add(copie);

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateException)
            {
                if (CopieExists(copie.CopieID))
                {
                    return(Conflict());
                }
                else
                {
                    throw;
                }
            }

            return(CreatedAtRoute("DefaultApi", new { id = copie.CopieID }, copie));
        }
示例#3
0
        public IHttpActionResult PutCopie(int id, Copie copie)
        {
            if (!ModelState.IsValid)
            {
                return(BadRequest(ModelState));
            }

            if (id != copie.CopieID)
            {
                return(BadRequest());
            }

            db.Entry(copie).State = EntityState.Modified;

            try
            {
                db.SaveChanges();
            }
            catch (DbUpdateConcurrencyException)
            {
                if (!CopieExists(id))
                {
                    return(NotFound());
                }
                else
                {
                    throw;
                }
            }

            return(StatusCode(HttpStatusCode.NoContent));
        }
示例#4
0
        public IHttpActionResult GetCopie(int id)
        {
            Copie copie = db.Copies.Find(id);

            if (copie == null)
            {
                return(NotFound());
            }

            return(Ok(copie));
        }
示例#5
0
        public IHttpActionResult DeleteCopie(int id)
        {
            Copie copie = db.Copies.Find(id);

            if (copie == null)
            {
                return(NotFound());
            }

            db.Copies.Remove(copie);
            db.SaveChanges();

            return(Ok(copie));
        }