Ejemplo n.º 1
0
 private ClanRanks GetClanRank(string name, ClanData clan)
 {
     if (clan.Leader == name)
     {
         return(ClanRanks.Leader);
     }
     if (clan.NumberOne == name)
     {
         return(ClanRanks.NumberOne);
     }
     if (clan.NumberTwo == name)
     {
         return(ClanRanks.NumberTwo);
     }
     return(ClanRanks.Member);
 }
Ejemplo n.º 2
0
        public void Load()
        {
            try
            {
                if (!_dbContext.Clans.Any())
                {
                    return;
                }

                foreach (DAL.Models.Clan clan in _dbContext.Clans)
                {
                    var newClan = new ClanData(clan.Id, clan.Name);
                    newClan.Description = clan.Description;
                    newClan.Board       = clan.BoardId;
                    newClan.ClanType    = EnumerationExtensions.GetEnum <ClanTypes>(clan.ClanType);
                    newClan.Motto       = clan.Motto;
                    newClan.Deity       = clan.DeityName;
                    newClan.Badge       = clan.Badge;
                    newClan.RecallRoom  = clan.RecallRoomId;
                    newClan.StoreRoom   = clan.StoreRoomId;

                    var clanStats = clan.Stats;
                    newClan.PvEKills       = clan.Stats.PvE_Kills;
                    newClan.PvEDeaths      = clan.Stats.PvE_Deaths;
                    newClan.IllegalPvPKill = clan.Stats.Illegal_PvP_Kills;
                    newClan.Score          = clan.Stats.Score;
                    newClan.Favour         = clan.Stats.Favour;
                    newClan.Strikes        = clan.Stats.Strikes;
                    newClan.MemberLimit    = clan.Stats.MemberLimit;
                    newClan.Alignment      = clan.Stats.Alignment;

                    var members = new List <RosterData>();
                    foreach (DAL.Models.ClanMember clanMember in clan.Members)
                    {
                        var newMember = new RosterData();
                        newMember.Name   = clanMember.Name;
                        newMember.Joined = clanMember.Joined;
                        newMember.Class  = clanMember.ClassId;
                        newMember.Level  = clanMember.Level;
                        newMember.Kills  = clanMember.Kills;
                        newMember.Deaths = clanMember.Deaths;
                        members.Add(newMember);
                    }
                    newClan.Members = members;

                    newClan.LeaderRank = clan.Ranks.First(x => x.RankType == (int)ClanRanks.Leader).RankName;
                    newClan.Leader     = clan.Members.First(x => x.ClanRank == (int)ClanRanks.Leader).Name;

                    newClan.NumberOneRank = clan.Ranks.First(x => x.RankType == (int)ClanRanks.NumberOne).RankName;
                    var member = clan.Members.FirstOrDefault(x => x.ClanRank == (int)ClanRanks.NumberOne);
                    newClan.NumberOne = member == null ? string.Empty : member.Name;

                    newClan.NumberTwoRank = clan.Ranks.First(x => x.RankType == (int)ClanRanks.NumberTwo).RankName;
                    member            = clan.Members.FirstOrDefault(x => x.ClanRank == (int)ClanRanks.NumberTwo);
                    newClan.NumberTwo = member == null ? string.Empty : member.Name;

                    newClan.ClanObjects = clan.Items.Select(x => x.Id);

                    Add(newClan);
                }

                _logManager.Boot("Loaded {0} Clans", Clans.Count());
            }
            catch (DbException ex)
            {
                _logManager.Error(ex);
                throw;
            }
        }
Ejemplo n.º 3
0
 public void Add(ClanData clan)
 {
     Clans.ToList().Add(clan);
 }