internal List <McRace> GetRaces(int[] ids)
        {
            List <McRace> raceList = new List <McRace>();

            #region Races
            foreach (var item in McDbCommunication.ReadRaces(ids))
            {
                raceList.Add(item);
            }
            #endregion

            foreach (var item in raceList)
            {
                List <McAbility> abilityList = new List <McAbility>();
                abilityList.AddRange(getAbilities(McDbCommunication.ReadAbilityIdsToRace(item.Id)));

                item.AbilityList = abilityList;

                List <McPromotion> promotionList = new List <McPromotion>();
                promotionList.AddRange(GetPromotions(McDbCommunication.ReadPromotionIdsToRace(item.Id)));

                item.PromotionList = promotionList;

                List <McTactic> tacticList = new List <McTactic>();
                tacticList.AddRange(GetTactics(McDbCommunication.ReadTacticIdsToRace(item.Id)));

                item.TacticList = tacticList;
            }

            raceList.OrderBy(x => x.Name);

            return(raceList);
        }
        internal List <McUnit> GetUnits(int[] ids)
        {
            List <McUnit> unitList = McDbCommunication.ReadUnits(ids).ToList();

            foreach (var item in unitList)
            {
                item.Size = McDbCommunication.ReadSizes(new int[1] {
                    item.SizeId
                })[0];
                item.Type = McDbCommunication.ReadTypes(new int[1] {
                    item.TypeId
                })[0];
                item.Level = McDbCommunication.ReadLevels(new int[1] {
                    item.LevelId
                })[0];
                item.Specialization = McDbCommunication.ReadSpecializations(new int[1] {
                    item.SpecializationId
                })[0];
                item.Race = McDbCommunication.ReadRaces(new int[1] {
                    item.RaceId
                })[0];
                item.Faction = item.FactionId < 1 ? null : McDbCommunication.ReadFactions(new int[1] {
                    item.FactionId
                })[0];
                item.Commander = item.CommanderId < 1 ? null : McDbCommunication.ReadCommanders(new int[1] {
                    item.CommanderId
                })[0];
            }



            return(unitList);
        }
Beispiel #3
0
        public McUnit(int id, string name, int sizeId, int typeId, int levelId, int xp, int specializationId, int raceId, int factionId, int commanderId, string icon, int mountId)
        {
            Id               = id;
            Name             = name;
            SizeId           = sizeId;
            TypeId           = typeId;
            LevelId          = levelId;
            Xp               = xp;
            SpecializationId = specializationId;
            RaceId           = raceId;
            FactionId        = factionId;
            CommanderId      = commanderId;
            IconString       = icon;
            MountId          = mountId;

            Size = McDbCommunication.ReadSizes(new int[1] {
                SizeId
            })[0];
            Type = McDbCommunication.ReadTypes(new int[1] {
                TypeId
            })[0];
            Level = McDbCommunication.ReadLevels(new int[1] {
                LevelId
            })[0];
            Specialization = McDbCommunication.ReadSpecializations(new int[1] {
                SpecializationId
            })[0];
            Race = McDbCommunication.ReadRaces(new int[1] {
                RaceId
            })[0];
            Faction = McDbCommunication.ReadFactions(new int[1] {
                FactionId
            })[0];
            //if(DBMasscombatCommunication.ReadCommanders(new int[1] { CommanderId })[0] != null) { Commander = DBMasscombatCommunication.ReadCommanders(new int[1] { CommanderId })[0]; }
            if (MountId > 0)
            {
                Mount = McDbCommunication.ReadRaces(new int[1] {
                    MountId
                })[0];
            }
            else
            {
                Mount = null;
            }

            AbilityList   = SetAbilityList();
            CommandList   = SetCommandList();
            EquipmentList = SetEquipmentList();
            PromotionList = SetPromotionList();
            TacticList    = SetTacticList();
        }