コード例 #1
0
    public void MovePreNPCNow(ClassNPC Class)
    {
        Moving            = true;
        HighLightingSlots = new List <SlotBattle>();
        OffALLBlinkSlot();

        if (Class.name == "Swordsman")
        {
            HighLightingSlots.AddRange(NormalMoving());
            HighLightingSlots.AddRange(WarriorlAtt());
        }
        else if (Class.name == "Archer")
        {
            HighLightingSlots.AddRange(NormalMoving());
            HighLightingSlots.AddRange(ArcherAtt());
            // HighLightingSlots.AddRange(MageHeal());
        }



        foreach (var item in HighLightingSlots)
        {
            CheckForHighLight(item);
        }
    }
コード例 #2
0
        public ActionResult AssoEdit(short infoId, short npcId, string submit,
                                     List <AssoClass_Npc> assoClasses,
                                     List <AssoOrg_Npc> orgs)
        {
            if (ModelState.IsValid)
            {
                #region Add Classes
                List <byte> currentClassId = db.ClassNPCs.Where(x => x.NpcId == npcId).Select(x => (byte)x.ClassId).ToList();
                if (assoClasses != null)
                {
                    foreach (AssoClass_Npc cn in assoClasses)
                    {
                        //if the association already exists
                        if (currentClassId.Contains(cn.ClassId))
                        {
                            ClassNPC toEdit = db.ClassNPCs.Where(x => x.ClassId == cn.ClassId && x.NpcId == npcId).First();
                            toEdit.ClassOrder      = cn.ClassOrder;
                            db.Entry(toEdit).State = EntityState.Modified;
                            db.SaveChanges();
                            currentClassId.Remove(cn.ClassId);
                        }
                        else
                        {
                            ClassNPC toAdd = new ClassNPC
                            {
                                NpcId      = npcId,
                                ClassId    = cn.ClassId,
                                ClassOrder = cn.ClassOrder
                            };
                            db.ClassNPCs.Add(toAdd);
                        }
                    }
                }
                if (currentClassId.Count != 0)
                {
                    foreach (byte id in currentClassId)
                    {
                        ClassNPC gone = db.ClassNPCs.Where(x => x.NpcId == npcId && x.ClassId == id).FirstOrDefault();
                        db.ClassNPCs.Remove(gone);
                    }
                }
                db.SaveChanges();
                #endregion

                #region Add Orgs
                List <short> currentOrgId = db.NpcOrgs.Where(x => x.NpcId == npcId).Select(x => x.OrgId).ToList();
                if (orgs != null)
                {
                    foreach (AssoOrg_Npc assoOrg in orgs)
                    {
                        //if the association already exists
                        if (currentOrgId.Contains(assoOrg.OrgId))
                        {
                            NpcOrg toEdit = db.NpcOrgs.Where(x => x.OrgId == assoOrg.OrgId && x.NpcId == npcId).First();
                            toEdit.OrgOrder     = assoOrg.OrgOrder;
                            toEdit.BlurbNpcPage = assoOrg.BlurbNpcPage;
                            toEdit.BlurbOrgPage = assoOrg.BlurbOrgPage;
                            toEdit.MemberOrder  = assoOrg.MemberOrder;
                            toEdit.IsCurrent    = assoOrg.IsCurrent;

                            db.Entry(toEdit).State = EntityState.Modified;
                            db.SaveChanges();
                            currentOrgId.Remove(assoOrg.OrgId);
                        }
                        else
                        {
                            NpcOrg toAdd = new NpcOrg
                            {
                                NpcId        = npcId,
                                OrgId        = assoOrg.OrgId,
                                OrgOrder     = assoOrg.OrgOrder,
                                BlurbNpcPage = assoOrg.BlurbNpcPage,
                                BlurbOrgPage = assoOrg.BlurbOrgPage,
                                MemberOrder  = assoOrg.MemberOrder,
                                IsCurrent    = assoOrg.IsCurrent
                            };
                            db.NpcOrgs.Add(toAdd);
                        }
                    }
                }
                if (currentOrgId.Count != 0)
                {
                    foreach (short id in currentOrgId)
                    {
                        NpcOrg gone = db.NpcOrgs.Where(x => x.NpcId == npcId & x.OrgId == id).FirstOrDefault();
                        db.NpcOrgs.Remove(gone);
                    }
                }
                db.SaveChanges();
                #endregion
                return(Json(true));
            }
            //if model fails
            ViewBag.Orgs    = db.Orgs.ToList();
            ViewBag.Classes = db.Classes.ToList();
            var       npc   = db.NPCs.Find(npcId);
            AssoNpcVM model = new AssoNpcVM {
                InfoId = infoId, NpcId = npcId, Submit = submit, Name = npc.Name, AssoClasses = assoClasses, AssoOrgs = orgs
            };
            return(View(model));
        }
コード例 #3
0
 public AssoClass_Npc(ClassNPC classNPC)
 {
     ClassId    = (byte)classNPC.ClassId;
     ClassOrder = classNPC.ClassOrder;
 }