Пример #1
0
 public PlanshetViewData SetPlanshetStarInfo(IDbConnection connection, StarInfoOut star)
 {
     return(PlanshetBodyHelper.SetBody(
                star,
                Resource.Star,
                IdConstructor(star.TypeNativeName, star.Id),
                MapInfoTemplates[3],
                MapInfoTemplates[4]));
 }
Пример #2
0
        public StarInfoOut GetStarInfo(IDbConnection connection, int starId)
        {
            var system = _systemService.GetSystem(connection, starId, i => i);

            if (system == null)
            {
                return(null);
            }

            var galaxyName = _galaxyService.GetGalaxyById(connection, system.GalaxyId, i => i.NativeName);

            if (galaxyName == null)
            {
                return(null);
            }

            var sectorName = _gSectorsService.GetById(connection, system.SectorId, i => i.NativeName);

            if (sectorName == null)
            {
                return(null);
            }

            var geometryStar = _systemService.GetGeometryStarById(connection, starId, i => i);

            if (geometryStar == null)
            {
                return(null);
            }

            var detailSystem = _systemService.GetDetailSystemBySystemId(connection, starId);

            if (detailSystem == null)
            {
                return(null);
            }

            var planetCountsInSystem = _gDetailPlanetService.GetPlanetCountInSystem(connection, starId);

            if (planetCountsInSystem == 0)
            {
                return(null);
            }


            var npcSkagry       = NpcHelper.GetNpcByName(Npc.SkagyName);
            var npcConfederaion = NpcHelper.GetNpcByName(Npc.ConfederationName);

            var owner        = npcSkagry.NpcUser.Nickname;
            var allianceName = npcSkagry.NpcAlliance.Name;


            if (detailSystem.AllianceId == npcConfederaion.NpcAlliance.Id)
            {
                owner        = npcConfederaion.NpcUser.Nickname;
                allianceName = npcConfederaion.NpcAlliance.Name;
            }
            if (detailSystem.UserName != null && detailSystem.UserName != npcSkagry.NpcUser.Nickname)
            {
                owner = detailSystem.UserName;
                if (detailSystem.AllianceId == npcConfederaion.NpcAlliance.Id)
                {
                    allianceName = npcConfederaion.NpcAlliance.Name;
                }
                else
                {
                    allianceName = _allianceService.GetAllianceById(connection, detailSystem.AllianceId, i => i.Name);
                }
            }

            var systemType = _gameTypeService.GetGGameType(connection, geometryStar.TypeId);
            var starInfo   = new StarInfoOut
            {
                GalaxyId             = system.GalaxyId,
                GalaxyName           = galaxyName,
                SectorId             = system.SectorId,
                SectorName           = sectorName,
                SystemId             = system.Id,
                SystemName           = detailSystem.Name,
                Id                   = system.Id,
                NativeName           = detailSystem.Name,
                TextureTypeId        = geometryStar.TextureTypeId,
                Owner                = owner,
                Bonus                = detailSystem.EnergyBonus,
                TypeNativeName       = systemType.Type,
                SubtypeNativeName    = systemType.SubType,
                SubtypeTranslateName = systemType.SubType,
                Description          =
                    L10N.ExecuteTranslateNameOrDescr(detailSystem.Description, false, L10N.GetCurrentCulture()),
                AllianceName = allianceName,
                ChildCount   = planetCountsInSystem,
                SpriteImages = new SpriteImages().StarImages(systemType.SubType, geometryStar.TextureTypeId)
            };

            starInfo.SetComplexButtonView();

            return(starInfo);
        }