Inheritance: MonoBehaviour
Exemple #1
0
        void InsertNewSummoner(Summoner summoner, DbConnection connection)
        {
            //We are dealing with a new summoner
            string query = string.Format("insert into summoner ({0}) values ({1})", GetGroupString(NewSummonerFields), GetPlaceholderString(NewSummonerFields));
            using (var newSummoner = Command(query, connection))
            {
                newSummoner.SetFieldNames(NewSummonerFields);

                newSummoner.Set(Profile.Identifier);

                newSummoner.Set(summoner.AccountId);
                newSummoner.Set(summoner.SummonerId);

                newSummoner.Set(summoner.SummonerName);
                newSummoner.Set(summoner.InternalName);

                newSummoner.Set(summoner.SummonerLevel);
                newSummoner.Set(summoner.ProfileIcon);

                newSummoner.Set(summoner.HasBeenUpdated);

                newSummoner.Set(summoner.UpdateAutomatically);

                long timestamp = Time.UnixTime();

                newSummoner.Set(timestamp);
                newSummoner.Set(timestamp);

                newSummoner.Execute();

                summoner.Id = GetInsertId(connection);
            }
        }
 // Use this for initialization
 void Start()
 {
     playerOnSummonArea = false;
     hint.SetActive(false);
     bloodCollector = GameObject.Find("Player").GetComponent<BloodCollector>();
     summoner = GameObject.Find("Altar").GetComponent<Summoner>();
 }
        public OperationResult UpdateSummonerByAccountId(int accountId)
        {
            if (!Connected)
                return OperationResult.NotConnected;

            WriteLine("Updating account {0}", accountId);
            ConcurrentRPC concurrentRPC = new ConcurrentRPC(RPC, accountId);
            OperationResult result = concurrentRPC.Run();
            if (result == OperationResult.Success)
            {
                Summoner newSummoner = new Summoner(concurrentRPC.PublicSummonerData, Region);
                Summoner summoner = StatisticsService.GetSummoner(Region, accountId);
                if (summoner == null)
                {
                    //The summoner wasn't in the database yet, add them
                    using (var connection = Provider.GetConnection())
                        InsertNewSummoner(newSummoner, connection);
                    summoner = newSummoner;
                }
                else
                {
                    //Copy data that might have been changed
                    summoner.SummonerName = newSummoner.SummonerName;
                    summoner.InternalName = newSummoner.InternalName;

                    summoner.SummonerLevel = newSummoner.SummonerLevel;
                    summoner.ProfileIcon = newSummoner.ProfileIcon;
                }
                //Perform a full update
                using (var connection = Provider.GetConnection())
                    UpdateSummoner(summoner, concurrentRPC, connection);
                return OperationResult.Success;
            }
            return result;
        }
	// Use this for initialization
	void Start () {
		slider = GetComponent<Slider>();
	
		if(Summoner == null)
		{
			Summoner = FindObjectOfType<Summoner>();
		}
	}
        // Karma = 43
        // golf1052 = 26040955
        // Chaox = 7460

        public SummonerTests()
        {
            List<string> summonerNames = new List<string>();
            summonerNames.Add("golf1052");
            List<Summoner> summoners = new List<Summoner>();
            Task task = Task.Run(async () => { summoners = await creepScore.RetrieveSummoners(CreepScore.Region.NA, summonerNames); });
            task.Wait();
            golf1052 = summoners[0];
        }
 public RanklistViewModel(Summoner summoner)
 {
     this.Id = summoner.SummonerId;
     this.Username = summoner.Username;
     this.LolUsername = summoner.LoLUsername;
     this.ServerName = summoner.Server1.Name;
     this.Score = summoner.Score;
     this.OverallScore = summoner.OverallScore;
 }
 void Start()
 {
     if (summoner == null)
     {
         summoner = GameObject.FindObjectOfType<Summoner>();
     }
     if (player == null)
     {
         player = GameObject.FindObjectOfType<PhysicsPlayerControl>();
     }
 }
Exemple #8
0
        //Returns true if the summoner was updated successfully, false otherwise
        public OperationResult FindSummoner(string summonerName, ref Summoner outputSummoner)
        {
            if (!Connected)
                return OperationResult.NotConnected;

            try
            {
                Summoner summoner = StatisticsService.GetSummoner(Region, summonerName);
                if (summoner != null)
                {
                    //The summoner is already in the database, don't update them, just provide the account ID
                    //This behaviour is more convenient for the general use case
                }
                else
                {
                    //The summoner name is not in the database
                    //Retrieve the account ID to see if it's actually a new summoner or just somebody who changed their name
                    PublicSummoner publicSummoner = RPC.GetSummonerByName(summonerName);
                    if (publicSummoner == null)
                    {
                        //No such summoner
                        return OperationResult.NotFound;
                    }

                    using (var connection = Provider.GetConnection())
                    {
                        summoner = StatisticsService.GetSummoner(Region, publicSummoner.acctId);
                        if (summoner != null)
                        {
                            //It's a summoner who was already in the database, just their name changed
                            UpdateSummonerFields(summoner, connection);
                        }
                        else
                        {
                            //It's a new summoner
                            summoner = new Summoner(publicSummoner, Region);
                            InsertNewSummoner(summoner, connection);
                            StatisticsService.AddSummonerToCache(Region, summoner);
                        }
                    }
                }
                outputSummoner = summoner;
                return OperationResult.Success;

            }
            catch (RPCTimeoutException)
            {
                return OperationResult.Timeout;
            }
            catch (RPCNotConnectedException)
            {
                return OperationResult.NotConnected;
            }
        }
Exemple #9
0
 public static BuildSet GetGameBuild(Game game, Summoner summoner)
 {
     if (PotentialUpgrades == null) InitializePotentialUpgrades();
     var set = new BuildSet();
     set.TimeSince = GetTimeSince(game.CreateDate);
     set.FinalBuild = getFinalBuild(game.Statistics);
     set.Champion = getChampion(game.ChampionId);
     set.FullBuild = set.FinalBuild.Items.Count == 7 && !(set.FinalBuild.Items.Any(x => PotentialUpgrades.ContainsKey(x.Id.ToString())));
     set.Id = game.GameId;
     set.SummonerId = summoner.Id;
     set.MatchDataFetched = false;
     set.TotalDamageDealt = game.Statistics.TotalDamageDealt;
     return set;
 }
        private int GetRanking(Summoner summoner, IEnumerable<RanklistViewModel> ranklist)
        {
            int position = 1;

            foreach (var ranker in ranklist)
            {
                if (ranker.Id == summoner.SummonerId)
                {
                    return position;
                }
                position++;
            }

            return 0;
        }
Exemple #11
0
        public async Task ValidateAuthFactorAsync_ShouldBeOfTypeValidationResult()
        {
            // Arrange
            var userId = new UserId();

            var summoner = new Summoner
            {
                ProfileIconId = 0,
                Name          = "testName",
                Region        = Region.Na,
                AccountId     = "testId"
            };

            TestMock.LeagueOfLegendsService.Setup(leagueService => leagueService.Summoner.GetSummonerByAccountIdAsync(It.IsAny <Region>(), It.IsAny <string>()))
            .ReturnsAsync(summoner)
            .Verifiable();

            TestMock.GameAuthenticationRepository.Setup(repository => repository.RemoveAuthenticationAsync(It.IsAny <UserId>(), It.IsAny <Game>()))
            .Returns(Task.CompletedTask)
            .Verifiable();

            var authFactorService = new LeagueOfLegendsAuthenticationValidatorAdapter(
                TestMock.LeagueOfLegendsService.Object,
                TestMock.GameAuthenticationRepository.Object);

            // Act
            var result = await authFactorService.ValidateAuthenticationAsync(
                userId,
                new GameAuthentication <LeagueOfLegendsGameAuthenticationFactor>(
                    new PlayerId(),
                    new LeagueOfLegendsGameAuthenticationFactor(
                        1,
                        string.Empty,
                        2,
                        string.Empty)));

            // Assert
            result.Should().BeOfType <DomainValidationResult <GameAuthentication> >();

            TestMock.LeagueOfLegendsService.Verify(
                leagueService => leagueService.Summoner.GetSummonerByAccountIdAsync(It.IsAny <Region>(), It.IsAny <string>()),
                Times.Once);

            TestMock.GameAuthenticationRepository.Verify(repository => repository.RemoveAuthenticationAsync(It.IsAny <UserId>(), It.IsAny <Game>()), Times.Once);
        }
        public async Task <Summoner> GetSummonerAsync(string summonerName)
        {
            Summoner summoner = null;


            var refitClient = RestService.For <ISummonerApi>(Config.LatinAmericaNorthSummonerApiUrl);

            var response = await refitClient.GetSummonerByNameAsync(summonerName, Config.ApiKey);

            if (response.IsSuccessStatusCode)
            {
                var jsonSummoner = await response.Content.ReadAsStringAsync();

                summoner = JsonConvert.DeserializeObject <Summoner>(jsonSummoner);
            }

            return(summoner);
        }
        public override void ViewDidLoad()
        {
            base.ViewDidLoad();

            var layout = new MainMenuCollectionViewFlowLayout(this);

            CollectionView.SetCollectionViewLayout(layout, true);

            CollectionView.DataSource = new MainMenuCollectionDataSource(this);
            CollectionView.RegisterClassForCell(typeof(SummonerMainMenuCell), BaseMainMenuCell.ID);
            CollectionView.IndicatorStyle = UIScrollViewIndicatorStyle.White;
            CollectionView.ReloadData();


            iLOL.iLOL.Init();

            var a = new Summoner("psiguard");
        }
Exemple #14
0
        public static BuildSet GetGameBuild(Game game, Summoner summoner)
        {
            if (PotentialUpgrades == null)
            {
                InitializePotentialUpgrades();
            }
            var set = new BuildSet();

            set.TimeSince        = GetTimeSince(game.CreateDate);
            set.FinalBuild       = getFinalBuild(game.Statistics);
            set.Champion         = getChampion(game.ChampionId);
            set.FullBuild        = set.FinalBuild.Items.Count == 7 && !(set.FinalBuild.Items.Any(x => PotentialUpgrades.ContainsKey(x.Id.ToString())));
            set.Id               = game.GameId;
            set.SummonerId       = summoner.Id;
            set.MatchDataFetched = false;
            set.TotalDamageDealt = game.Statistics.TotalDamageDealt;
            return(set);
        }
Exemple #15
0
 public void GetMasteryPoints()
 {
     commands.CreateCommand("Mastery")
     .Do(async(e) =>
     {
         string returnstring       = "";
         SettingsRepo settingsRepo = new SettingsRepo(new SettingsContext());
         Summoner summoner         = null;
         try
         {
             DataLibary.Models.User user =
                 new UserRepo(new UserContext()).GetUserByDiscord(e.User.Id);
             summoner =
                 new SummonerAPI().GetSummoner(
                     new SummonerRepo(new SummonerContext()).GetSummonerByUserId(user),
                     ToolKit.LeagueAndDatabase.GetRegionFromDatabaseId(
                         new RegionRepo(new RegionContext()).GetRegionId(user)
                         ));
         }
         catch
         {
         }
         if (settingsRepo.MasteryPointsByAccount(e.Server.Id))
         {
             if (summoner != null)
             {
                 int points = new MasteryAPI().GetPoints(summoner,
                                                         new ChampionAPI().GetChampion(settingsRepo.GetChampionId(e.Server.Id), RiotSharp.Region.eune));
                 Discord.Role r = e.Server.GetRole(settingsRepo.GetRoleByPoints(e.Server.Id, points));
                 await e.User.AddRoles(r);
                 returnstring = Eng_Default.RoleHasBeenGiven(r.Name);
             }
             else
             {
                 returnstring = Eng_Default.RegisterAccount();
             }
         }
         else
         {
             returnstring = Eng_Default.ServerDoesNotAllow();
         }
         await e.Channel.SendMessage(returnstring);
     });
 }
        private string GetMailmessage(User user, Summoner summoner)
        {
            const string pattern = @"*I'm a bot whose purpose is to deliver League of Legends flairs.*

----

> **This message is to notify you that the flair `{flair}` has been delivered to your Reddit account.**

> **From time to time, we'll check if your rank changes and update your flair. You won't hear back from me again. Thanks.**

----

[Report a problem](https://www.reddit.com/message/compose?to=kivinkujata&subject=Issue+with+FeralFlair) | 
[Author](https://www.reddit.com/message/compose?to=kivinkujata&subject=Ranked+Flairs) |
[GitHub](https://github.com/jessehallam/RedditRankedFlairs) | {version}";

            return(pattern.Replace("{flair}", LeagueUtil.Stringify(summoner.LeagueInfo))
                   .Replace("{version}", _config.FlairBotVersion));
        }
        public static Summoner GetSummonerID(string summonerName)
        {
            var api = System.IO.File.ReadAllText("api.txt");

            var url = $"https://na1.api.riotgames.com/lol/summoner/v4/summoners/by-name/{summonerName}?api_key={api}";

            var client  = new RestClient(url);
            var request = new RestRequest(Method.GET);

            IRestResponse response = client.Execute(request);

            var data = JObject.Parse(response.Content);

            var summoner = new Summoner();

            summoner.SummonerID = (string)data["id"];

            return(summoner);
        }
Exemple #18
0
        public double GetSpellCooldown(Spell spell, Summoner participant)
        {
            // assuming the player always levels when possible
            // TODO: check for special level behaviour(Elise, Jayce, Karma, ...)
            double cooldown = 0;

            if (spell.MaxRank >= 1 && participant.Level < 3)
            {
                cooldown = spell.Cooldown[0];
            }
            else if (spell.MaxRank >= 2 && participant.Level < 5)
            {
                cooldown = spell.Cooldown[1];
            }
            else if (spell.MaxRank >= 3 && participant.Level < 7)
            {
                cooldown = spell.Cooldown[2];
            }
            else if (spell.MaxRank >= 4 && participant.Level < 9)
            {
                cooldown = spell.Cooldown[3];
            }
            else if (spell.MaxRank >= 5 && participant.Level < 11)
            {
                cooldown = spell.Cooldown[4];
            }
            else if (spell.MaxRank >= 6)
            {
                cooldown = spell.Cooldown[5];
            }

            double abilityHaste = 0;

            foreach (var itemId in participant.Items.Select(x => x.Id))
            {
                var item = GetItem(itemId);
                abilityHaste += item.AbilityHaste;
            }

            // TODO: check for runes

            return(cooldown / (1 + (abilityHaste / 100)));
        }
Exemple #19
0
        public async Task <IActionResult> Index()
        {
            League = await LeagueClient.Connect();

            var region = await League.MakeApiRequest(LCUSharp.HttpMethod.Get, "/riotclient/region-locale");

            var locals = JsonConvert.DeserializeObject <Region>(region.Content.ReadAsStringAsync().Result);

            Summoners sum    = new Summoners(League);
            var       player = sum.GetCurrentSummoner();

            Summoner user = new Summoner();

            user.SummonerID   = player.SummonerId.ToString();
            user.SummonerName = player.DisplayName;
            user.Region       = locals.RegionRegion;
            user.Role         = "Test";
            return(View(user));
        }
Exemple #20
0
        public Summoner GetSummonerInfo(string summonerName)
        {
            //Try and grab summoner from database
            string searchSummoner = summonerName.Replace(" ", string.Empty).ToLower();

            List <DAC.Entities.Summoner> summonersReturned = _summonerRepo.SummonerLookup(searchSummoner);

            if (summonersReturned == null)
            {
                // Grab from riot apis
                Summoner summoner = _liveData.RetrieveSummonerByName(Regions.NA1, searchSummoner);

                //Save the summoner into the database
                _summonerRepo.SaveNewSummoner(_mapper.Map <DAC.Entities.Summoner>(summoner));
                return(summoner);
            }
            // On summoner returned from the database, will now use that
            return(_mapper.Map <Summoner>(summonersReturned.FirstOrDefault()));
        }
Exemple #21
0
        public void EndDeadLineTimer()
        {
            if (DeadLineTimer != null)
            {
                DeadLineTimer.Stop();
                DeadLineTimer = null;
            }

            if (Guardian != null && Guardian.Alive) // Failed
            {
                Guardian.Delete();

                if (Summoner != null)
                {
                    Summoner.SendLocalizedMessage(1151628); // You failed to defeat the champion in time.
                }
                NextSummon = DateTime.UtcNow;
            }
        }
Exemple #22
0
        // GET: Summoner/Details/5
        public ActionResult Details(String name)
        {
            Summoner summ;

            using (var client = new HttpClient())
            {
                String test = "https://na1.api.riotgames.com/lol/summoner/v3/summoners/by-name/" + name + "?api_key=RGAPI-a96d441a-123e-40ec-a6d2-d9a3b0c4a65b";
                var    uri  = new Uri(test);

                var response = client.GetAsync(uri).Result;
                var temp     = response.Content.ReadAsStreamAsync().Result;
                var result   = response.Content.ReadAsStringAsync().Result;
                var content  = JObject.Parse(result);

                String img = "http://ddragon.leagueoflegends.com/cdn/8.14.1/img/profileicon/" + content["profileIconId"] + ".png";
                summ = new Summoner(img, content["name"].ToString(), (long)content["summonerLevel"]);
            }
            return(View(summ));
        }
Exemple #23
0
        private static void GetLeagueByDivisionSync(ComboBox region, ComboBox division, ComboBox league, ListBox list)
        {
            var leagueEntries = Riot.LeagueExpV4.GetLeagueEntries(Utility.GetRegion(region.Text), QueueType.RANKED_SOLO_5x5, Utility.GetTier(league.Text), Utility.GetDivision(division.Text));

            for (int i = 0; i < 10; i++)
            {
                SummonerData current  = new SummonerData();
                Summoner     summoner = new Summoner();

                summoner = Riot.SummonerV4.GetBySummonerName(Utility.GetRegion(region.Text), leagueEntries[i].SummonerName);

                current.Name      = leagueEntries[i].SummonerName;
                current.AccountId = summoner.AccountId;

                GetRoleInfoSync(region, current);

                DataList.Add(current);
            }
        }
Exemple #24
0
    // Use this for initialization
    void Start()
    {
        cursor             = GameObject.FindObjectOfType <Cursor>();
        moveMenuHandler    = GameObject.FindObjectOfType <MoveMenuHandler>();
        mapGenerator       = GameObject.FindObjectOfType <MapGenerator>();
        cam                = GameObject.FindObjectOfType <CameraController>();
        lastTimeX          = Time.time;
        lastTimeDown       = Time.time;
        lastTimeUp         = Time.time;
        lastTimeZ          = Time.time;
        lastTimeLeft       = Time.time;
        lastTimeRight      = Time.time;
        characters         = new ArrayList();
        characterPositions = new ArrayList();
        turn               = FindObjectOfType <Turns>();
        Summoner[] s = FindObjectsOfType <Summoner>();
        enemyPositions  = new ArrayList();
        summonPositions = new ArrayList();
        charsInRange    = new ArrayList();

        if (s[0].playerNumber == 1)
        {
            summoner1 = s[0];
            summoner2 = s[1];
        }
        else
        {
            summoner1 = s[1];
            summoner2 = s[0];
        }

        spacer     = cursor.size / 1.5f;
        mapTiles   = new ArrayList();
        mapTilePos = new ArrayList();

        GameObject[] mt = GameObject.FindGameObjectsWithTag("MapTile");
        moveTilePositions = new ArrayList();
        for (int i = 0; i < mt.Length; i++)
        {
            mapTiles.Add(mt[i]);
            mapTilePos.Add(new Vector2(realRound(mt[i].transform.position.x / spacer), realRound(mt[i].transform.position.y / spacer)));
        }
    }
 public IHttpActionResult Get([FromUri] string summonerName, [FromUri] string region)
 {
     if (Array.IndexOf(Globals.REGIONS, region) != 1)
     {
         var summoner = new Summoner().GetByName(summonerName, region);
         if (summoner == null)
         {
             return(BadRequest());
         }
         else
         {
             return(Ok(summoner));
         }
     }
     else
     {
         return(BadRequest());
     }
 }
Exemple #26
0
        public static ChampionPickResult PickChampion(Summoner currentSummoner, ChampionEnum champion)
        {
            var session = ClientLCU.GetChampSelectSession();
            var cellId  = -1;
            var id      = -1;

            foreach (var summoner in session.myTeam)
            {
                if (summoner.summonerId == currentSummoner.summonerId)
                {
                    cellId = summoner.cellId;
                }
            }

            foreach (var summoner in session.actions[0])
            {
                if (summoner.championId == (int)champion)
                {
                    return(ChampionPickResult.ChampionPicked);
                }

                if (summoner.actorCellId == cellId)
                {
                    id = summoner.id;
                }
            }


            int[] pickableChampions = GetPickableChampions();

            if (!pickableChampions.Contains((int)champion))
            {
                return(ChampionPickResult.ChampionNotOwned);
            }

            int championId = (int)champion;

            using (var request = CreateRequest())
            {
                var result = request.Patch(PickURL + id, "{\"actorCellId\": 0, \"championId\": " + championId + ", \"completed\": true, \"id\": " + id + ", \"isAllyAction\": true, \"type\": \"string\"}", "application/json").ToString();
                return(ChampionPickResult.Ok);
            }
        }
Exemple #27
0
        public async Task <IEnumerable <Summoner> > GetMasterLeague()
        {
            List <Summoner> summoners = new List <Summoner>();

            RateLimiter();
            HttpResponseMessage response = await _httpClient.GetAsync(masterLeagues.Replace("{queue}", "RANKED_SOLO_5x5"));

            League challenger = JsonConvert.DeserializeObject <League>(await response.Content.ReadAsStringAsync());

            foreach (LeagueItem leagueItem in challenger.entries)
            {
                Summoner toAdd = await GetSummoner(int.Parse(leagueItem.playerOrTeamId));

                toAdd.leaguePoints = leagueItem.leaguePoints;
                toAdd.losses       = leagueItem.losses;
                toAdd.wins         = leagueItem.wins;
                summoners.Add(toAdd);
            }
            return(summoners);
        }
Exemple #28
0
        public DamageLib(AIHeroClient source)
        {
            this.source = source;

            #region Scaling Functions Initialization

            ScalingFunc.Add("AP", (x) => (x * source.TotalMagicalDamage));
            ScalingFunc.Add("AD", (x) => (x * source.TotalAttackDamage));
            ScalingFunc.Add("BONUS_AD", (x) => (x * (source.TotalAttackDamage - source.BaseAttackDamage)));
            ScalingFunc.Add("ARMOR", (x) => (x * source.Armor));
            ScalingFunc.Add("MR", (x) => (x * source.MagicShield));
            ScalingFunc.Add("MAXHEALTH", (x) => (x * source.MaxHealth));
            ScalingFunc.Add("MAXMANA", (x) => (x * source.MaxMana));

            #endregion


            Summoner s_IGNITE = new Summoner("summonerdot", 600);
            RegistDamage("IGNITE", DamageType.True, 0, 0, DamageType.True, ScalingType.AD, 0, delegate(Obj_AI_Base target) { return(s_IGNITE.IsReady()); }, delegate(Obj_AI_Base target) { return(50 + 20 * source.Level); });
        }
        public async Task GetUserInfoAsync()
        {
            var region = await League.MakeApiRequest(LCUSharp.HttpMethod.Get, "/riotclient/region-locale");

            var locals = JsonConvert.DeserializeObject <Region>(region.Content.ReadAsStringAsync().Result);

            Summoners sum    = new Summoners(League);
            var       player = sum.GetCurrentSummoner();

            Summoner user = new Summoner();

            user.SummonerID   = player.SummonerId.ToString();
            user.SummonerName = player.DisplayName;
            user.Region       = locals.RegionRegion;
            user.Role         = "Test";

            http = new HttpClient();
            var content = new StringContent(JsonConvert.SerializeObject(user), Encoding.UTF8, "application/json");
            await http.PostAsync("https://lossummonerinfoapi.azurewebsites.net/api/AddSummoner", content);
        }
 protected override void EntityUpdate()
 {
     base.EntityUpdate();
     if (IsSummoned)
     {
         if (Summoner != null)
         {
             if (Vector3.Distance(CacheTransform.position, Summoner.CacheTransform.position) > GameInstance.maxFollowSummonerDistance)
             {
                 // Teleport to summoner if too far from summoner
                 CacheNetTransform.Teleport(Summoner.GetSummonPosition(), Summoner.GetSummonRotation());
             }
         }
         else
         {
             // Summoner disappear so destroy it
             UnSummon();
         }
     }
 }
Exemple #31
0
 private void CreateCharacter(Summoner newSummoner, SummonerData summonerJson)
 {
     newSummoner.id            = summonerJson.id;
     newSummoner.idOriginal    = summonerJson.idOriginal;
     newSummoner.tier          = summonerJson.tier;
     newSummoner.nbDiceMax     = summonerJson.nbDiceMax;
     newSummoner.nbDice        = summonerJson.nbDice;
     newSummoner.nbSkillSlots  = summonerJson.nbSkillSlots;
     newSummoner.nbItemSlots   = summonerJson.nbItemSlots;
     newSummoner.summonerName  = summonerJson.summonerName;
     newSummoner.idAvatar      = summonerJson.idAvatar;
     newSummoner.pvMax         = summonerJson.pvMax;
     newSummoner.pv            = summonerJson.pv;
     newSummoner.force         = summonerJson.force;
     newSummoner.armure        = summonerJson.armure;
     newSummoner.characterType = summonerJson.characterType;
     newSummoner.L_skills      = summonerJson.L_skills;
     newSummoner.L_talents     = summonerJson.L_talents;
     newSummoner.L_etats       = summonerJson.L_etats;
 }
Exemple #32
0
 // Update is called once per frame
 void Update()
 {
     characterPositions.Clear();
     characters.Clear();
     Character[] chars = GameObject.FindObjectsOfType <Character>();
     for (int i = 0; i < chars.Length; i++)
     {
         characters.Add((Character)chars[i]);
         characterPositions.Add(roundPosition(chars[i].transform.position));
         //get context of the summoners (if they werent found yet)
         if (chars[i].name == "Summoner" && chars[i].playerNumber == 1)
         {
             summoner1 = (Summoner)chars[i];
         }
         if (chars[i].name == "Summoner" && chars[i].playerNumber == 2)
         {
             summoner2 = (Summoner)chars[i];
         }
     }
 }
        private Summoner UpdateExisting(Summoner existing, Summoner summoner)
        {
            summoner.Rev = existing.Rev;
//            existing.AccountId = summoner.AccountId;
//            existing.InternalName = summoner.InternalName;
//            existing.LastCrawledDate = summoner.LastCrawledDate;
//            existing.LastGameDate = summoner.LastGameDate;
//            existing.LeaverPenalties = summoner.LeaverPenalties;
//            existing.Level = summoner.Level;
//            existing.Name = summoner.Name;
//            existing.PreviousFirstWinOfDay = summoner.PreviousFirstWinOfDay;
//            existing.ProfileIconId = summoner.ProfileIconId;
//            existing.PromotionGamesPlayed = summoner.PromotionGamesPlayed;
//            existing.PromotionGamesPlayedUpdatedDate = summoner.PromotionGamesPlayedUpdatedDate;
//            existing.RevisionDate = summoner.RevisionDate;
//            existing.SeasonOneTier = summoner.SeasonOneTier;
//            existing.SeasonTwoTier = summoner.SeasonTwoTier;
//            existing.SeasonThreeTier = summoner.SeasonThreeTier;
            return(summoner);
        }
Exemple #34
0
        public Summoner GetSummonerByName(string name, string region)
        {
            var uri = new Uri("https://" + region + ".api.riotgames.com/lol/summoner/v4/summoners/by-name/" + name +
                              "?api_key=" + Config.ApiKey);
            Summoner response = null;

            try
            {
                response = new HttpClient().GetFromJsonAsync <Summoner>(uri).Result;
            }
            catch (HttpRequestException e)
            {
                Console.WriteLine("Message :{0} ", e.Message);
            }
            catch (AggregateException e)
            {
                Console.WriteLine("Message :{0} ", e.Message);
            }
            return(response);
        }
 public Player(Summoner summonerObject)
 {
     InitializeComponent();
     _summoner = summonerObject;
     RunePages = _summoner.GetRunePages();
     MasteryPages = _summoner.GetMasteryPages();
     RecentGames = _summoner.GetRecentGames();
     StatsSummary = _summoner.GetStatsSummaries();
     try
     {
         League = _summoner.GetLeagues();
         EntireLeague = _summoner.GetEntireLeagues();
         RankedStats = _summoner.GetStatsRanked();
     }
     catch
     {
         _playedRanked = false;
     }
     InitalizePlayerProfile();
     SetupTabs();
 }
        private List <Summoner> GetAll()
        {
            if (!File.Exists(mFilePath))
            {
                return(new List <Summoner>());
            }

            if (!mCache.CachedAllIsValid())
            {
                string  json    = File.ReadAllText(mFilePath);
                JObject profile = JObject.Parse(json);

                Summoner summoner = JsonConvert.DeserializeObject <Summoner>(JsonConvert.SerializeObject(profile["wizard_info"]));

                mCache.CacheAll(new List <Summoner> {
                    summoner
                });
            }

            return(mCache.CachedAll);
        }
Exemple #37
0
        public async void TestSummoner()
        {
            client.DefaultRequestHeaders.Clear();
            client.DefaultRequestHeaders.Add("X-Riot-Token", key);
            _summoner = await LoLViewer.LoLViewerMain.FillSummoner(key, "Aclyptic", client);

            _controlSummoner.profileIconId = 938;
            _controlSummoner.name          = "Aclyptic";
            _controlSummoner.summonerLevel = 108;
            _controlSummoner.accountId     = 33911210;
            _controlSummoner.id            = 21044320;
            _controlSummoner.revisionDate  = 1543455263000;


            Assert.Equal(_controlSummoner.profileIconId, _summoner.profileIconId);
            Assert.Equal(_controlSummoner.name, _summoner.name);
            Assert.Equal(_controlSummoner.summonerLevel, _summoner.summonerLevel);
            Assert.Equal(_controlSummoner.accountId, _summoner.accountId);
            Assert.Equal(_controlSummoner.id, _summoner.id);
            Assert.Equal(_controlSummoner.revisionDate, _summoner.revisionDate);
        }
        // get the current game data from a summoner object and region, then parse that data into showing on the UI
        private async Task getCurrentGame(Summoner summoner, Region region)
        {
            try
            {
                // get current game object
                var game = await api.Spectator.GetCurrentGameAsync(region, summoner.Id);

                // get the participants list of the enemy team
                getEnemyTeam(game, summoner);

                // turn the enemy team list into summonerGroups to be displayed in the GUI
                await parseEnemyTeam(enemyTeam);
            }
            // if summoner isn't in a live game or there was an issue parsing, throw an exception, bringing us back to page 1
            catch (Exception)
            {
                Console.WriteLine("COULD NOT FIND CURRENT GAME");

                throw new Exception("summoner is not in live game or text file could not be found");
            }
        }
Exemple #39
0
        private void Pick_t()
        {
            Summoner sum = rift.GetSummoner();

            bool success = false;

            while (!success)
            {
                string champion = "Annie";
                this.Invoke((MethodInvoker) delegate()
                {
                    if (cmbBox_Champion.SelectedItem != null)
                    {
                        champion = cmbBox_Champion.SelectedItem.ToString();
                    }
                });

                championSelected = dDragon.champions.Data[champion];
                success          = rift.PickChampion(championSelected);
            }
        }
Exemple #40
0
        static async Task GetSummonerData(string summonerName)
        {
            try
            {
                IRiotClient client = new RiotClient(new RiotClientSettings
                {
                    ApiKey = System.IO.File.ReadAllText(API_KEY_PATH)
                });

                Summoner summoner = await client.GetSummonerBySummonerNameAsync(summonerName, PlatformId.EUW1).ConfigureAwait(false);

                Console.WriteLine($"Summoner Name: {summoner.Name}");
                Console.WriteLine($"Summoner Platform ID: {PlatformId.EUW1}");
                Console.WriteLine($"Summoner ID: {summoner.Id}");
                Console.WriteLine($"Summoner Level: {summoner.SummonerLevel}");
            }
            catch (Exception ex)
            {
                Console.WriteLine("Invalid account");
            }
        }
        public async Task <IHttpActionResult> Get(string SummonerName)
        {
            try
            {
                Summoner summoner = await WebApiApplication.api.GetSummonerAsync(RiotSharp.Region.br, SummonerName);

                SummonerModel model = new SummonerModel()
                {
                    SummonerName  = summoner.Name,
                    SummonerId    = summoner.Id,
                    SummonerIcon  = ReturnUrlChampion(summoner.ProfileIconId),
                    SummonerLevel = summoner.Level
                };

                return(Ok(model));
            }
            catch (Exception ex)
            {
                return(InternalServerError(ex));
            }
        }
        public UsersViewModel(Summoner summoner)
        {
            this.Id = summoner.SummonerId;
            this.Username = summoner.Username;
            this.LolUsername = summoner.LoLUsername;
            this.ServerName = summoner.Server1.Name;
            this.Server = summoner.Server1.ServerId;
            this.Score = summoner.Score;
            this.OverallScore = summoner.OverallScore;

            ranklistRepository rankRep = new ranklistRepository();
            this.Rank = rankRep.GetRank(summoner);
            this.OverallRank = rankRep.GetOverallRank(summoner);

            this.DateRegistered = summoner.DateRegistered;
            this.Synced = summoner.Synced;
            this.LastActive = summoner.Logs.OrderBy(l => l.Date).Last().Date;
            this.last9Logs =
                from log in summoner.Logs.OrderByDescending(l => l.Date).Take(9)
                select new EventLogsViewModel(log);
            this.Games = summoner.SummonersGames.ToList();
        }
 void Start()
 {
     summoner = GameObject.Find("Summoner").GetComponent<Summoner>();
     countdownDisplay = GameObject.Find("tbxTimeLeft").GetComponent<Text>();
     stage1Active = stage2Active = stage3Active = stage4Active = false;
     switch (GameController.instance.difficulty()) {
     case 0:
         //Debugging Code
         stage1 = 1000;
         stage2 = 2000;
         stage3 = 3000;
         stage4 = 4000;
         break;
     case 1:
         stage1 = 60 * 5;
         stage2 = 60 * 10;
         stage3 = 60 * 15;
         stage4 = 60 * 20;
         break;
     case 2:
         stage1 = 60 * 7.5f;
         stage2 = 60 * 15;
         stage3 = 60 * 22.5f;
         stage4 = 60 * 30;
         break;
     case 3:
         stage1 = 60 * 10;
         stage2 = 60 * 20;
         stage3 = 60 * 30;
         stage4 = 60 * 40;
         break;
     case 4:
         stage1 = 60 * 15;
         stage2 = 60 * 30;
         stage3 = 60 * 45;
         stage4 = 60 * 60;
         break;
     }
 }
 public ServiceUser(Summoner summoner)
 {
     this.User = summoner;
 }
Exemple #45
0
 Vector2 CoordOf(Summoner summoner)
 {
     Vector3 pos = summoner.transform.localPosition;
     return new Vector2(Mathf.Floor(pos.x), Mathf.Floor(pos.z));
 }
 public SummonerProfileResult(OperationResult result)
 {
     Result = result.GetString();
     Summoner = null;
 }
        public OperationResult UpdateSummonerByAccountId(int accountId, bool isAutoUpdate = false)
        {
            if (!Connected)
                return OperationResult.NotConnected;

            ConcurrentRPC concurrentRPC = new ConcurrentRPC(RPC, accountId);
            OperationResult result = concurrentRPC.Run();

            if (result == OperationResult.Success)
            {
                if (concurrentRPC.PublicSummonerData == null)
                {
                    //This means that the summoner was not found, even though the other structures are actually non-null
                    return OperationResult.NotFound;
                }

                Summoner newSummoner = new Summoner(concurrentRPC.PublicSummonerData, Region);
                Summoner summoner = StatisticsService.GetSummoner(Region, accountId);

                if (summoner == null)
                {
                    //The summoner wasn't in the database yet, add them
                    using (var connection = Provider.GetConnection())
                        InsertNewSummoner(newSummoner, connection);
                    summoner = newSummoner;

                    summoner.LastUpdateTrial = 0;
                }
                else
                {
                    //Copy data that might have been changed
                    summoner.SummonerName = newSummoner.SummonerName;
                    summoner.InternalName = newSummoner.InternalName;

                    summoner.SummonerLevel = newSummoner.SummonerLevel;
                    summoner.ProfileIcon = newSummoner.ProfileIcon;
                }

                // too bad i have to query summoner by name because i dont have revision date
                PublicSummoner publicSummoner;

                try
                {
                    publicSummoner = RPC.GetSummonerByName(summoner.SummonerName);
                }
                catch(RPCTimeoutException)
                {
                    return OperationResult.Timeout;
                }

                if (publicSummoner == null)
                    return OperationResult.NotFound;

                newSummoner.RevisionDate = (int)publicSummoner.revisionDate.ToUnixTime();

                if ((summoner == newSummoner) || (summoner.RevisionDate < newSummoner.RevisionDate))
                {
                    summoner.RevisionDate = newSummoner.RevisionDate;

                    if (isAutoUpdate)
                        summoner.LastUpdateTrial = 0;
                }
                else if ( (isAutoUpdate) || (summoner.LastUpdateTrial == 0) )
                    summoner.LastUpdateTrial++;

                //Perform a full update, eh
                using (var connection = Provider.GetConnection())
                    UpdateSummoner(summoner, concurrentRPC, connection);

                WriteLine("Updated account {0}, trial {1}", accountId, summoner.LastUpdateTrial);

                return OperationResult.Success;
            }

            return result;
        }
Exemple #48
0
 public static List<MatchSummary> GetRecentMatchesEventually(Summoner summoner)
 {
     List<MatchSummary> summaries = null;
     var tries = 0;
     while (summaries == null)
     {
         if (tries > MAX_TRIES) { throw new Exception(); }
         tries++;
         summaries = GetRecentMatches(summoner);
     }
     return summaries;
 }
Exemple #49
0
 public static List<Game> GetRecentGamesEventually(Summoner summoner)
 {
     var tries = 0;
     List<Game> summaries = null;
     while (summaries == null)
     {
         if (tries > MAX_TRIES) { throw new Exception(); }
         tries++;
         summaries = GetRecentGames(summoner);
     }
     return summaries;
 }
Exemple #50
0
 public static List<Game> GetRecentGames(Summoner summoner)
 {
     try
     {
         var api = RiotApi.GetInstance(API_KEY);
         var games = api.GetRecentGames(Region.na, summoner.Id);
         return games;
     }
     catch
     {
         return null;
     }
 }
Exemple #51
0
	// Use this for initialization

    void Awake()
    {
        sngl = this;
    }
 public SummonerRegisterInfoModel(Summoner s)
 {
     Summoner = s;
 }
 public int GetRank(Summoner summoner)
 {
     var ranklist = this.GetRanklist();
     return GetRanking(summoner, ranklist);
 }
 public SummonerProfileResult(Summoner summoner)
 {
     Result = OperationResult.Success.ToString();
     Summoner = summoner;
 }
Exemple #55
0
 public static List<MatchSummary> GetRecentMatches(Summoner summoner)
 {
     try
     {
         var api = RiotApi.GetInstance(API_KEY);
         var matches = api.GetMatchHistory(Region.na, summoner.Id);
         return matches;
     }
     catch
     {
         return null;
     }
 }
Exemple #56
0
 void ShowHealthBar(Summoner s, Color full, Color empty)
 {
     GUILayout.BeginHorizontal();
     GUILayout.Label("HP", textStyle);
     GUILayout.FlexibleSpace();
     GUILayout.Label(Mathf.CeilToInt(s.Health) + "/" + s.MaxHealth, textStyle);
     GUILayout.EndHorizontal();
     GUI.color = new Color(0, 0, 0, 0.75f);
     GUILayout.BeginHorizontal(outlineStyle);
     GUI.color = full;
     GUILayout.Box("", boxStyle, GUILayout.Width(360.0f * s.Health / s.MaxHealth), GUILayout.Height(10));
     GUI.color = empty;
     GUILayout.Box("", boxStyle, GUILayout.Width(360 * (1 - (s.Health / s.MaxHealth))), GUILayout.Height(10));
     GUI.color = Color.white;
     GUILayout.EndHorizontal();
 }