Esempio n. 1
0
        public static void UserClubStatistics()
        {
            foreach (var club in ClubLogic.GetActiveClubs())
            {
                try
                {
                    var clubMemberFortune = 0;
                    var clubMemberCredit  = 0;
                    var clubMemberLoyalty = 0;
                    var clubMemberRP      = 0;

                    var members = ClubLogic.GetClubMembers(club.ID.Value);

                    foreach (var member in members)
                    {
                        try
                        {
                            var userInfo = Users.GetShortUserInfo(member.Userid.Value);

                            if (userInfo != null)
                            {
                                clubMemberFortune += (int)userInfo.Extcredits2;
                                clubMemberCredit  += userInfo.Credits;
                                clubMemberLoyalty += (int)(DateTime.Now - member.JoinClubDate.Value).TotalDays;
                                clubMemberRP      += (int)userInfo.Extcredits4;
                            }
                        }
                        catch
                        {
                        }
                    }

                    club.MemberFortune = clubMemberFortune;
                    club.MemberCredit  = clubMemberCredit;
                    club.MemberLoyalty = clubMemberLoyalty;
                    club.MemberRP      = clubMemberRP;

                    var ra = new RankAlgorithm(club);
                    club.RankScore = ra.SummaryRankPoint;

                    ClubLogic.SaveClub(club);
                }
                catch
                {
                }
            }
        }
Esempio n. 2
0
        public static void CalcClubFortuneIncrement()
        {
            foreach (var club in ClubLogic.GetActiveClubs())
            {
                try
                {
                    var clubFortuneIncrement = 0;

                    var members = ClubLogic.GetClubMembers(club.ID.Value);

                    foreach (var member in members)
                    {
                        try
                        {
                            var userInfo = Users.GetShortUserInfo(member.Userid.Value);

                            if (userInfo != null)
                            {
                                clubFortuneIncrement += FortuneContributeAlgorithm.CalcContributeFortune(userInfo, true);

                                //int memberFortune = (int)userInfo.Extcredits2;
                                //int memberCredit = userInfo.Credits;
                                //float memberMana = userInfo.Extcredits1;//威望

                                //clubFortuneIncrement += (int)(Config.ClubFortuneIncrementVariable * Math.Pow(Math.Log10(memberCredit), 4)) + (int)((memberMana + 1) * Math.Log10(memberFortune));
                            }
                        }
                        catch
                        {
                        }
                    }

                    club.Fortune = club.Fortune.Value + clubFortuneIncrement;

                    var ra = new RankAlgorithm(club);
                    club.RankLevel = RankLevel.GetInstance().GetRank(club.Fortune.Value).ID;

                    ClubLogic.SaveClub(club);
                }
                catch
                {
                }
            }
        }