Exemplo n.º 1
0
 public PlanshetViewData SetPlanshetPlanetInfo(IDbConnection connection, PlanetInfoOut planet)
 {
     return(PlanshetBodyHelper.SetBody(planet,
                                       Resource.Planet,
                                       IdConstructor(planet.TypeNativeName, planet.Id),
                                       MapInfoTemplates[3],
                                       MapInfoTemplates[4]));
 }
Exemplo n.º 2
0
        public PlanetInfoOut GetPlanetInfo(IDbConnection connection, int planetId, int currentUserId)
        {
            var planetGeometry = _geometryPlanetService.GetGeometryPlanetById(connection, planetId);

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

            var planetType = _gameTypeService.GetGGameType(connection, planetGeometry.TypeId);

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


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

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

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

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

            var systemName = _systemService.GetDetailSystemBySystemId(connection, planetGeometry.SystemId, i => i.Name);

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


            var planetDetail = _gDetailPlanetService.GetPlanet(connection, planetId);

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


            var skagry             = NpcHelper.GetNpcByName(Npc.SkagyName);
            var userName           = skagry.NpcUser.Nickname;
            var planetAllianceName = skagry.NpcAlliance.Name;

            if (planetDetail.UserId != skagry.NpcUser.Id)
            {
                userName           = _gameUserService.GetGameUser(connection, planetDetail.UserId, i => i.Nickname);
                planetAllianceName = _allianceService.GetAllianceById(connection, planetDetail.AllianceId, i => i.Name);
            }
            var isCurrentUser = currentUserId == planetDetail.UserId;


            var planetInfo = new PlanetInfoOut
            {
                GalaxyId                 = planetGeometry.GalaxyId,
                GalaxyName               = galaxyName,
                SectorId                 = planetGeometry.SectorId,
                SectorName               = sectorName,
                SystemId                 = planetGeometry.SystemId,
                SystemName               = systemName,
                Id                       = planetGeometry.Id,
                NativeName               = planetDetail.Name,
                TextureTypeId            = planetGeometry.TextureTypeId,
                Owner                    = userName,
                LastActive               = planetDetail.LastActive,
                PlanetReferToCurrentUser = isCurrentUser,
                TypeNativeName           = planetType.Type,
                SubtypeNativeName        = planetType.SubType,
                Description              =
                    L10N.ExecuteTranslateNameOrDescr(planetDetail.Description, false, L10N.GetCurrentCulture()),
                AllianceName = planetAllianceName,
                ChildCount   = planetDetail.MoonCount,
                SpriteImages = new SpriteImages().PlanetImages(planetType.SubType, planetGeometry.TextureTypeId)
            };


            if (string.Equals(planetInfo.SubtypeNativeName, PlanetoidSubTypes.Earth.ToString(),
                              StringComparison.CurrentCultureIgnoreCase))
            {
                planetInfo.SubtypeTranslateName = "translate Earth";
            }
            else if (string.Equals(planetInfo.SubtypeNativeName, PlanetoidSubTypes.Gas.ToString(),
                                   StringComparison.CurrentCultureIgnoreCase))
            {
                planetInfo.SubtypeTranslateName = "translate Gas Gigant";
            }
            else if (string.Equals(planetInfo.SubtypeNativeName, PlanetoidSubTypes.IceGas.ToString(),
                                   StringComparison.CurrentCultureIgnoreCase))
            {
                planetInfo.SubtypeTranslateName = "translate Ice";
            }
            planetInfo.SetComplexButtonView();
            return(planetInfo);
        }