Esempio n. 1
0
 public static void DisposeData(UserGuild userGuild)
 {
     if (userGuild.LoadSuccess)
     {
         GameActive gameActive = new ShareCacheStruct <GameActive>().FindKey(UserGuild.ActiveID);
         userGuild.LoadSuccess = false;
         if (gameActive != null && gameActive.ActiveType == FunctionEnum.Goujili)
         {
             GuildBossCombat.Dispose(userGuild);
         }
     }
 }
Esempio n. 2
0
 public static void LoadData(UserGuild userGuild)
 {
     if ((userGuild.CombatStatus == CombatStatus.Wait || userGuild.CombatStatus == CombatStatus.Combat) && !userGuild.LoadSuccess)
     {
         GameActive gameActive = new ShareCacheStruct <GameActive>().FindKey(UserGuild.ActiveID);
         userGuild.LoadSuccess = true;
         if (gameActive != null && gameActive.ActiveType == FunctionEnum.Gonghui)
         {
             GuildBossCombat.InitBoss(userGuild);
         }
     }
 }
Esempio n. 3
0
 public override bool TakeAction()
 {
     if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
     {
         Stopwatch stopwatch = new Stopwatch();
         stopwatch.Start();
         GuildBossCombat bossCombat = new GuildBossCombat(ContextUser.MercenariesID);
         UserGuild _guild = bossCombat.UserGuild;
         if (_guild != null)
         {
             CombatGeneral boss = bossCombat.Boss;
             if (boss != null)
             {
                 currLifeNum = boss.LifeNum;
                 maxLifeNum = boss.LifeMaxNum;
             }
         }
         stopwatch.Stop();
         new BaseLog().SaveLog("公会boss刷新血量所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms");
     }
     return true;
 }
Esempio n. 4
0
        public override bool TakeAction()
        {
            if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
            {
                GuildBossCombat bossCombat = new GuildBossCombat(ContextUser.MercenariesID);
                UserGuild guild = bossCombat.UserGuild;
                if (guild != null)
                {
                    CombatStatus combatStatus = guild.CombatStatus;
                    if (combatStatus == CombatStatus.Killed || CombatHelper.GuildBossKill(ContextUser.MercenariesID))
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                        return false;
                    }
                    else if (combatStatus == CombatStatus.Wait)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5405_CombatWait;
                        return false;
                    }
                    else if (combatStatus == CombatStatus.Over)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5405_CombatOver;
                        return false;
                    }
                    else if (combatStatus == CombatStatus.Combat)
                    {
                        var cuser = bossCombat.GetCombatUser(Uid);
                        if (cuser != null && cuser.CodeTime > 0)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St5402_IsReliveError;
                            return false;
                        }
                        Stopwatch stopwatch = new Stopwatch();
                        stopwatch.Start();
                        IsWin = bossCombat.Combat(ContextUser, bossProcess);
                        stopwatch.Stop();
                        new BaseLog().SaveLog("公会boss战斗所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms");

                    }
                    else
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart;
                        return false;
                    }
                }
            }
            return true;
        }
Esempio n. 5
0
        public override bool TakeAction()
        {
            if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
            {
                if (CombatHelper.GuildBossKill(ContextUser.MercenariesID))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                    return false;
                }
                GuildBossCombat bossCombat = new GuildBossCombat(ContextUser.MercenariesID);
                UserGuild guild = bossCombat.UserGuild;
                if (guild != null)
                {
                    CombatStatus combatStatus = guild.CombatStatus;
                    if (combatStatus != CombatStatus.Wait && combatStatus != CombatStatus.Combat)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart;
                        return false;
                    }
                    ErrorCode = ops;
                    if (ops == 1)
                    {
                        ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireTip, ExpNum);
                    }
                    else if (ops == 2)
                    {
                        if (ContextUser.ExpNum < ExpNum)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_ExpNumNotEnough;
                            return false;
                        }
                        if (!bossCombat.Inspire(Uid, false, out inspirePercent))
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_InspireFailed;
                        }

                        if (ContextUser.ExpNum >= ExpNum)
                        {
                            ContextUser.ExpNum = MathUtils.Subtraction(ContextUser.ExpNum, ExpNum, 0);
                            //ContextUser.Update();
                        }
                    }
                    else if (ops == 3)
                    {
                        ErrorInfo = string.Format(LanguageManager.GetLang().St5202_InspireGoldTip, GlodNum);
                    }
                    else if (ops == 4)
                    {
                        if (ContextUser.GoldNum < GlodNum)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                            return false;
                        }
                        if (!bossCombat.Inspire(Uid, true, out inspirePercent))
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_InspireFailed;
                        }

                        if (ContextUser.GoldNum >= GlodNum)
                        {
                            ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, GlodNum, int.MaxValue);
                            //ContextUser.Update();
                        }
                    }
                }
            }
            return true;
        }
Esempio n. 6
0
 public override bool TakeAction()
 {
     if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
     {
         Stopwatch stopwatch = new Stopwatch();
         stopwatch.Start();
         GuildBossCombat bossCombat = new GuildBossCombat(ContextUser.MercenariesID);
         UserGuild guild = bossCombat.UserGuild;
         if (guild != null)
         {
             GameActive gameActive = new ShareCacheStruct<GameActive>().FindKey(_activeId);
             CombatStatus combatStatus = guild.CombatStatus;
             if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat)
             {
                 int total;
                 var tempList = bossCombat.RefreshRanking();
                 _bossUserList = tempList.GetPaging(1, Top, out total);
                 _rankingNo = tempList.FindIndex( m => m.UserId == Uid) + 1;
             }
         }
         stopwatch.Stop();
         new BaseLog().SaveLog("公会boss伤害排名所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms");
     }
     return true;
 }
Esempio n. 7
0
        public override bool TakeAction()
        {
            if (!string.IsNullOrEmpty(ContextUser.MercenariesID) && ContextUser.MercenariesID == guildID)
            {
                if (CombatHelper.GuildBossKill(ContextUser.MercenariesID))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                    return false;
                }
                Stopwatch stopwatch = new Stopwatch();
                stopwatch.Start();
                GameActive gameActive = new ShareCacheStruct<GameActive>().FindKey(_activeId);
                if (gameActive != null)
                {
                    bossPlotID = gameActive.BossPlotID;
                    GuildBossCombat bossCombat = new GuildBossCombat(guildID);
                    if (bossCombat.HasCombat)
                    {
                        _guild = bossCombat.UserGuild;
                        if (_guild != null && _guild.GuildBossInfo != null)
                        {
                            if (_guild.GuildBossInfo.EnableWeek > 0 && _guild.GuildBossInfo.BossLv > 0)
                            {
                                _guild.BeginTime = UserHelper.GuildBossDate(_guild.GuildBossInfo);
                                _guild.EndTime = _guild.BeginTime.AddMinutes(gameActive.Minutes);
                                CombatStatus combatStatus = _guild.GuildBossRefreshStatus();
                                if (UserHelper.IsCurrentWeek(_guild.BeginTime) &&
                                    UserHelper.IsCurrentWeek(_guild.GuildBossInfo.RefreshDate))
                                {
                                    if (DateTime.Now < _guild.BeginTime)
                                    {
                                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                                        ErrorInfo = LanguageManager.GetLang().St6101_GuildBossNotOpen;
                                        return false;
                                    }
                                    else if ((combatStatus == CombatStatus.Killed && DateTime.Now < _guild.EndTime) ||
                                             DateTime.Now > _guild.EndTime)
                                    {
                                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                                        ErrorInfo = LanguageManager.GetLang().St6101_GuildBossOver;
                                        return true;
                                    }
                                }
                                else
                                {
                                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                    ErrorInfo = LanguageManager.GetLang().St6101_GuildBossSet;
                                    return false;
                                }

                                if (combatStatus == CombatStatus.Wait || combatStatus == CombatStatus.Combat)
                                {
                                    bossCombat.Append(ContextUser);
                                    BossUser bossUser = bossCombat.GetCombatUser(ContextUser.UserID);
                                    if (bossUser != null)
                                    {
                                        _inspirePercent = bossUser.InspirePercent;
                                        _reliveInspirePercent = bossUser.ReliveInspirePercent;
                                        _reLiveNum = bossUser.ReliveNum;
                                    }
                                }
                                List<BossUser> userList = bossCombat.GetCombatUser();
                                _regNum = userList.Count;
                                int recordCount = 0;
                                _bossUserList = userList.GetPaging(_pageIndex, _pageSize, out recordCount);
                            }
                        }
                    }
                    else
                    {
                        UserGuild guild = new ShareCacheStruct<UserGuild>().FindKey(ContextUser.MercenariesID);
                        if (guild != null && guild.GuildBossInfo != null)
                        {
                            if (guild.GuildBossInfo.EnableWeek > 0 && guild.GuildBossInfo.BossLv > 0)
                            {
                                guild.BeginTime = UserHelper.GuildBossDate(guild.GuildBossInfo);
                                guild.EndTime = guild.BeginTime.AddMinutes(gameActive.Minutes);
                                if (UserHelper.IsCurrentWeek(guild.BeginTime) &&
                                    UserHelper.IsCurrentWeek(guild.GuildBossInfo.RefreshDate))
                                {
                                    if (DateTime.Now < guild.BeginTime.AddMinutes(1))
                                    {
                                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                                        ErrorInfo = LanguageManager.GetLang().St6101_GuildBossNotOpen;
                                        return false;
                                    }
                                    else
                                    {
                                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                                        ErrorInfo = LanguageManager.GetLang().St6101_GuildBossOver;
                                        return true;
                                    }
                                }
                                else
                                {
                                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                                    ErrorInfo = LanguageManager.GetLang().St6101_GuildBossSet;
                                    return false;
                                }
                            }
                        }
                        else
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St6101_GuildBossSet;
                            return false;
                        }
                    }
                }
                stopwatch.Stop();
                new BaseLog().SaveLog("公会boss6101所需时间:" + stopwatch.Elapsed.TotalMilliseconds + "ms");
            }
            return true;
        }
Esempio n. 8
0
        public override bool TakeAction()
        {
            if (!string.IsNullOrEmpty(ContextUser.MercenariesID))
            {
                if (CombatHelper.GuildBossKill(ContextUser.MercenariesID))
                {
                    ErrorCode = LanguageManager.GetLang().ErrorCode;
                    ErrorInfo = LanguageManager.GetLang().St5405_BossKilled;
                    return false;
                }
                GuildBossCombat bossCombat = new GuildBossCombat(ContextUser.MercenariesID);
                UserGuild guild = bossCombat.UserGuild;
                if (guild != null)
                {
                    if (!VipHelper.GetVipOpenFun(ContextUser.VipLv, ExpandType.BossChongSheng))
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St_VipNotEnoughNotFuntion;
                        return false;
                    }
                    CombatStatus combatStatus = guild.CombatStatus;
                    if (combatStatus != CombatStatus.Wait && combatStatus != CombatStatus.Combat)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5402_CombatNoStart;
                        return false;
                    }
                    ErrorCode = Ops;

                    BossUser bossUser = bossCombat.GetCombatUser(Uid);
                    if (bossUser != null && !bossUser.IsRelive)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5403_IsLive;
                        return false;

                    }
                    if (bossUser != null && bossUser.ReliveNum >= MaxNum)
                    {
                        ErrorCode = LanguageManager.GetLang().ErrorCode;
                        ErrorInfo = LanguageManager.GetLang().St5403_IsReLiveMaxNum;
                        return false;

                    }
                    int goldNum = GoldNum * (bossUser.ReliveNum + 1);
                    if (Ops == 1)
                    {
                        ErrorInfo = string.Format(LanguageManager.GetLang().St5403_CombatGoldTip, goldNum);
                    }
                    else if (Ops == 2)
                    {
                        if (ContextUser.GoldNum < goldNum)
                        {
                            ErrorCode = LanguageManager.GetLang().ErrorCode;
                            ErrorInfo = LanguageManager.GetLang().St_GoldNotEnough;
                            return false;
                        }
                        if (bossUser != null && bossUser.IsRelive)
                        {
                            if (bossUser.IsRelive)
                            {
                                ContextUser.UseGold = MathUtils.Addition(ContextUser.UseGold, goldNum, int.MaxValue);
                                //ContextUser.Update();
                                bossUser.IsRelive = false;
                                bossUser.ReliveBeginDate = DateTime.MinValue;
                                bossUser.ReliveInspirePercent = MathUtils.Addition(bossUser.ReliveInspirePercent, CountryCombat.InspireIncrease, 1);
                                _reliveInspirePercent = bossUser.ReliveInspirePercent;
                                bossUser.ReliveNum++;
                            }
                        }
                    }
                }
            }
            return true;
        }