Esempio n. 1
0
 public UserGuild()
     : base(AccessLevel.ReadWrite)
 {
     GuildBossInfo = new GuildBossInfo();
     AbilityInfo   = new CacheList <GuildAbility>();
     GuildExercise = new GuildExercise();
 }
Esempio n. 2
0
        /// <summary>
        /// 初始化BOSS数据
        /// </summary>
        /// <returns></returns>
        private static CombatGeneral CreateBossGeneral(UserGuild guild)
        {
            CombatGeneral boss = null;

            if (guild != null)
            {
                GuildBossInfo bossInfo = guild.GuildBossInfo;
                if (bossInfo != null)
                {
                    var plotNpcInfoList = new ConfigCacheSet <PlotNPCInfo>().FindAll(m => m.PlotID == gameActive.BossPlotID);
                    if (plotNpcInfoList.Count > 0)
                    {
                        var embattleList = new ConfigCacheSet <PlotEmbattleInfo>().FindAll(m => m.PlotNpcID == plotNpcInfoList[0].PlotNpcID);
                        if (embattleList.Count > 0)
                        {
                            boss    = (CombatGeneral)MonsterQueue.Create(embattleList[0]);
                            boss.Lv = (short)MathUtils.Subtraction(bossInfo.BossLv, 0, gameActive.BossDefLv);
                            int bossLiftNum = MonsterQueue.BossProperty(embattleList[0].PlotNpcID, AbilityType.ShengMing).ToInt();
                            int lifeNum     = boss.LifeNum + (boss.Lv - gameActive.BossDefLv) * bossLiftNum; //ConfigEnvSet.GetInt("BossCombat.IncreaseLiveNum");
                            boss.LifeMaxNum = lifeNum;
                            boss.LifeNum    = lifeNum;
                        }
                    }
                    else
                    {
                        throw new Exception(string.Format("公会战未配置BOSS:{0}", gameActive.BossPlotID));
                    }
                }
            }
            if (boss == null)
            {
                throw new Exception("Loading guid boss faild.");
            }
            return(boss);
        }
Esempio n. 3
0
        public override bool TakeAction()
        {
            UserGuild guild = new ShareCacheStruct <UserGuild>().FindKey(ContextUser.MercenariesID);

            if (guild != null)
            {
                GuildMember member = new ShareCacheStruct <GuildMember>().FindKey(ContextUser.MercenariesID, ContextUser.UserID);
                if (member == null || member.PostType != PostType.Chairman)
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St6008_NotChairman;
                    return(false);
                }
                GameActive      active        = new ShareCacheStruct <GameActive>().FindKey(UserGuild.ActiveID);
                List <BossDate> bossDateList  = UserHelper.GetBossDate().FindAll(u => u.EnableWeek == dateType);
                GuildBossInfo   guildBossInfo = guild.GuildBossInfo;
                if (bossDateList.Count > 0)
                {
                    BossDate bossDate = bossDateList[0];

                    if (guildBossInfo != null)
                    {
                        if (guildBossInfo.RefreshDate != MathUtils.SqlMinDate)
                        {
                            if (UserHelper.IsCurrentWeek(guild.GuildBossInfo.RefreshDate))
                            {
                                ErrorCode = LanguageManager.GetLang().ErrorCode;
                                ErrorInfo = LanguageManager.GetLang().St6109_GuildBossTime;
                                return(false);
                            }
                        }

                        if (guildBossInfo.BossLv == 0)
                        {
                            guildBossInfo.BossLv = (short)active.BossLv;
                        }
                        guildBossInfo.IsKill       = false;
                        guildBossInfo.EnablePeriod = bossDate.EnablePeriod;
                        guildBossInfo.EnableWeek   = (int)dateType;
                        guildBossInfo.RefreshDate  = DateTime.Now;
                        guild.GuildBossInfo        = guildBossInfo;
                        //guild.Update();
                    }
                    else
                    {
                        guildBossInfo              = new GuildBossInfo();
                        guildBossInfo.IsKill       = false;
                        guildBossInfo.BossLv       = (short)active.BossLv;
                        guildBossInfo.EnablePeriod = bossDate.EnablePeriod;
                        guildBossInfo.EnableWeek   = (int)dateType;
                        guildBossInfo.RefreshDate  = DateTime.Now;
                        guild.GuildBossInfo        = guildBossInfo;
                        //guild.Update();
                    }
                }
            }
            return(true);
        }
Esempio n. 4
0
        /// <summary>
        /// 公会boss挑战时间
        /// </summary>
        /// <param name="bossInfo"></param>
        /// <returns></returns>
        public static DateTime GuildBossDate(GuildBossInfo bossInfo)
        {
            BossDateType bossDateType = (BossDateType)Enum.Parse(typeof(BossDateType), bossInfo.EnableWeek.ToString());
            string       weekDateTime = GetDateTime(bossDateType).ToString("d");
            string       hourDate     = DateTime.Parse(bossInfo.EnablePeriod).ToString("T");
            string       currDate     = weekDateTime + " " + hourDate;
            DateTime     priod        = DateTime.Parse(currDate);

            return(priod);
        }
Esempio n. 5
0
 public static short GetBossDateType(GuildBossInfo bossInfo)
 {
     if (bossInfo != null)
     {
         if (UserHelper.IsCurrentWeek(bossInfo.RefreshDate))
         {
             return((short)bossInfo.EnableWeek);
         }
     }
     return((short)0);
 }
Esempio n. 6
0
        protected override object this[string index]
        {
            get
            {
                #region
                switch (index)
                {
                case "GuildID": return(GuildID);

                case "GuildName": return(GuildName);

                case "UserID": return(UserID);

                case "GuildLv": return(GuildLv);

                case "GuildRank": return(GuildRank);

                case "CurrExperience": return(CurrExperience);

                case "WeekExperience": return(WeekExperience);

                case "Announcement": return(Announcement);

                case "GuildDesc": return(GuildDesc);

                case "CreateDate": return(CreateDate);

                case "GuildBossInfo": return(GuildBossInfo);

                case "AddMember": return(AddMember);

                case "CurrDonateNum": return(CurrDonateNum);

                case "AbilityInfo": return(AbilityInfo);

                case "GuildExercise": return(GuildExercise);

                default: throw new ArgumentException(string.Format("UserGuild index[{0}] isn't exist.", index));
                }
                #endregion
            }
            set
            {
                #region
                switch (index)
                {
                case "GuildID":
                    _GuildID = value.ToNotNullString();
                    break;

                case "GuildName":
                    _GuildName = value.ToNotNullString();
                    break;

                case "UserID":
                    _UserID = value.ToNotNullString();
                    break;

                case "GuildLv":
                    _GuildLv = value.ToShort();
                    break;

                case "GuildRank":
                    _GuildRank = value.ToInt();
                    break;

                case "CurrExperience":
                    _CurrExperience = value.ToInt();
                    break;

                case "WeekExperience":
                    _WeekExperience = value.ToInt();
                    break;

                case "Announcement":
                    _Announcement = value.ToNotNullString();
                    break;

                case "GuildDesc":
                    _GuildDesc = value.ToNotNullString();
                    break;

                case "CreateDate":
                    _CreateDate = value.ToDateTime();
                    break;

                case "GuildBossInfo":
                    _GuildBossInfo = ConvertCustomField <GuildBossInfo>(value, index);
                    break;

                case "AddMember":
                    _AddMember = value.ToInt();
                    break;

                case "CurrDonateNum":
                    _CurrDonateNum = value.ToInt();
                    break;

                case "AbilityInfo":
                    _AbilityInfo = ConvertCustomField <CacheList <GuildAbility> >(value, index);
                    break;

                case "GuildExercise":
                    _GuildExercise = ConvertCustomField <GuildExercise>(value, index);
                    break;

                default: throw new ArgumentException(string.Format("UserGuild index[{0}] isn't exist.", index));
                }
                #endregion
            }
        }