private AllianceMembers _getAllianceMembers(IDbConnection connection, int userId, int userAllianceId, IGameUserService gameUserService) { var allianceMembers = new AllianceMembers(); var allianceUsers = GetAllianceUsers(connection, userAllianceId); var members = new List <AllianceMember>(); foreach (var a in allianceUsers) { var user = gameUserService.GetGameUser(connection, a.UserId); var member = new AllianceMember { AllianceUserId = a.Id, UserId = a.UserId, UserName = user.Nickname, OnlineStatus = user.IsOnline, UserPvp = user.PvpPoint, Role = new AllianceRole(a.RoleId) }; members.Add(member); } allianceMembers.CurrentUserRoleName = members.Where(i => i.UserId == userId).Select(i => i.Role.RoleName).First(); allianceMembers.Members = members; allianceMembers.SetComplexButtonView(); return(allianceMembers); }
public UserRattingItem RatingGetUser(IDbConnection connection, IGameUserService gu, int userId) { var user = gu.GetGameUser(connection, userId); var top = gu.GetTopPosition(connection, user.Id, user.PvpPoint); return(new UserRattingItem(user, top)); }
public UserDataModel CreateGameUser(IDbConnection connection, string userAuthId, string userName, ref bool existBefore, int?userId = null) { var user = _gameUserService.GetGameUser(connection, userAuthId); if (user != null && user.Id != 0) { existBefore = true; return(user); } var newUser = _gameUserService.AddOrUpdate(connection, _createUserModel(userAuthId, userName)); if (userId != null) { newUser.Id = (int)userId; } return(newUser); }
// todo не работает public TabReportOut CreateReportItem(IDbConnection connection, string id) { throw new NotImplementedException("ReportItem(string id) метод не работает проверить место вызова"); var random = new Random(); var randPlanetId = random.Next(300, 500); var tmpSorce = false; var tPlanet = _gDetailPlanetService.GetPlanet(connection, randPlanetId, i => i); var systemName = _geometryPlanetService.GetPlanetSystemName(connection, randPlanetId); var tUser = _gameUserService.GetGameUser(connection, tPlanet.UserId); var j = new TabReportOut { Id = 300, TargetUserName = tUser.Nickname, TargetSystemName = systemName, TargetPlanetName = tPlanet.Name, TargetResource = tPlanet.Resources.Current.ConvertToInt(), SourceOwnType = false, SourceUserName = "", //get user //TargetHangar = HangarUnitsOut.EmptyHangar(), //todo временно назначен LeftImage = (!tmpSorce) ? ImageView.Img(_spriteImages.MapControlIcons("jumptomother").Icon) : ImageView.Img(_spriteImages.MapControlIcons("jumptoplanetoid").Icon), RightImage = ImageView.Img(_spriteImages.MapControlIcons("jumptoplanetoid").Icon), // RightImage = ImageView.Img("r-RightImage"), Date = UnixTime.GetDateFromTimeStamp(DateTime.UtcNow), TimeNow = UnixTime.GetTimeFromTimeStamp(DateTime.UtcNow) }; if (tmpSorce) { } return(j); }
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); }
internal static UserDataModel GetGameUser(this ConnectionUser connectionUser, IDbConnection connection, IGameUserService gameUserService) { return(gameUserService.GetGameUser(connection, connectionUser.UserId)); }