Exemplo n.º 1
0
        //Arry's allyCode: 267126851
        public async Task <ViewResult> PlayerDetails(int allyCode)
        {
            Player player = await SwgohApiProcessor.MakeRequest <Player>($"player/{allyCode}");

            player.data.ArenaLeader = await this.GetCharacterByBaseId(player.data.arena_leader_base_id);

            player.data.FleetArenaLeader = await this.GetShipByBaseId(player.data.fleet_arena.leader);

            foreach (string member in player.data.arena.members)
            {
                Character toAdd = await this.GetCharacterByBaseId(member);

                Unit unit = player.GetUnitByBaseId(toAdd.base_id);
                toAdd.Level     = unit.data.level;
                toAdd.UnitPower = unit.data.power;
                player.data.ArenaMembers.Add(toAdd);
            }
            foreach (string ship in player.data.fleet_arena.members)
            {
                Ship toAdd = await this.GetShipByBaseId(ship);

                Unit unit = player.GetUnitByBaseId(toAdd.base_id);
                toAdd.Level     = unit.data.level;
                toAdd.UnitPower = unit.data.power;
                player.data.FleetArenaMembers.Add(toAdd);
            }
            foreach (string ship in player.data.fleet_arena.reinforcements)
            {
                Ship toAdd = await this.GetShipByBaseId(ship);

                Unit unit = player.GetUnitByBaseId(toAdd.base_id);
                toAdd.Level     = unit.data.level;
                toAdd.UnitPower = unit.data.power;
                player.data.FleetArenaReinforcements.Add(toAdd);
            }

            return(View(player));
        }
Exemplo n.º 2
0
        private async Task <Ship> GetShipByBaseId(string baseId)
        {
            List <Ship> shipList = await SwgohApiProcessor.MakeRequest <List <Ship> >("ships");

            return(shipList.Where(s => s.base_id == baseId).FirstOrDefault());
        }
Exemplo n.º 3
0
        private async Task <Character> GetCharacterByBaseId(string baseId)
        {
            List <Character> charList = await SwgohApiProcessor.MakeRequest <List <Character> >("characters");

            return(charList.Where(c => c.base_id == baseId).FirstOrDefault());
        }
Exemplo n.º 4
0
        // Starforge Omega: 37072
        public async Task <ActionResult> GuildDetails(int guildId)
        {
            Guild guild = await SwgohApiProcessor.MakeRequest <Guild>($"guild/{guildId}");

            return(View(guild));
        }