Пример #1
0
        public override void Execute()
        {
            var army = this._site.InitArmyGroup();

            if (army != null)
            {
                bool isCaption = this._site.CheckIsGroupCaption();

                this._site.ArmyGroupLeave();

                foreach (var c in army.CharaInfoVoList)
                {
                    var gc = CharacterCache.GetCharByNo(c.CharaNo);
                    if (gc != null)
                    {
                        CharacterArmyGroupCache.ClearCache(gc.CharaId);
                        AllMapCache.ClearCache(gc.CharaId);
                    }
                }

                if (isCaption)
                {
                    CharacterConfigCache.CancelDungeonGuaji(this._site.Config);
                }
            }

            Response.WriteAsync(JsonUtil.Serialize(new { }));
        }
Пример #2
0
        public override void Execute()
        {
            string aid = GetQuery("aid");

            this._site.ArmyGroupJoin(aid);

            CharacterConfigCache.CancelGuaji(this._site.Config);

            CharacterArmyGroupCache.ClearCache(this._site.CurrentCharId);
            var army = this._site.InitArmyGroup();

            if (army != null)
            {
                foreach (var c in army.CharaInfoVoList)
                {
                    var gc = CharacterCache.GetCharByNo(c.CharaNo);
                    if (gc != null && gc.CharaId != this._site.CurrentCharId)
                    {
                        CharacterArmyGroupCache.ClearCache(gc.CharaId);
                    }
                }
            }

            Response.WriteAsync(JsonUtil.Serialize(new { }));
        }
        private void InternalProcessAllyRecord(int count, string mapId)
        {
            var group = this._site.InitArmyGroup();

            foreach (var gc in group.CharaInfoVoList)
            {
                var c = CharacterCache.GetCharByNo(gc.CharaNo);
                if (c != null && c.Id != this._site.CurrentCharId)
                {
                    var allyBattleList = this._site.BattleArmyRecord(gc.CharaNo);
                    for (var i = 0; i < count; i++)
                    {
                        BattleResult battle     = allyBattleList[i];
                        BattleResult prevBattle = i > 0 ? allyBattleList[i - 1] : null;
                        GenerateBattleChars(battle, true, prevBattle != null ? prevBattle.LifeAfter : null);
                        GenerateBattleTurns(battle, true);

                        var  cd     = CharacterDynamicCache.TryGetValue(c.Id, CharacterDynamicCache.LoadDynamic);
                        bool addExp = i == count - 1;
                        UpdateCharDynamic(battle, cd, mapId, addExp);

                        if (this.OnBattleComplete != null)
                        {
                            battle.TotalCount = cd.BattleLevelTotalCount;
                            battle.EPM        = cd.EPM;

                            this.OnBattleComplete(c.Id, battle);
                        }
                    }
                    BattleScheduler.ResultDic[c.Id] = allyBattleList.Take(count).ToList();
                }
            }
        }
Пример #4
0
 public ArmyGroup InitArmyGroup()
 {
     return(CharacterArmyGroupCache.TryGetValue(this.CurrentCharId, id =>
     {
         string path = string.Format("/foodie-api/gameAmry/armyBoundary/?charaId={0}", this.CurrentCharId);
         var group = this.PostResult <ArmyGroup>(path, null, false);
         if (group != null)
         {
             var captionNo = group.CharaInfoVoList.FirstOrDefault(p => p.IsCaption).CharaNo;
             var caption = CharacterCache.GetCharByNo(captionNo);
             if (caption != null)
             {
                 group.CaptainName = caption.Name;
                 group.CaptainNo = caption.AccountId;
                 group.CaptionId = caption.Id;
             }
         }
         return group;
     }));
 }
        private void GenerateBattleChars(BattleResult battle, bool isGroup = false, Dictionary <string, int> lifeBeforeDict = null)
        {
            for (var j = 0; j < battle.GameMonList.Count; j++)
            {
                battle.GameMonList[j].BattleCharId = j.ToString();
            }

            if (isGroup)
            {
                var group = this._site.InitArmyGroup();
                battle.LeftList = group.CharaInfoVoList.Select(p => CharacterCache.GetCharByNo(p.CharaNo)).Where(p => p != null).ToList();
            }
            else
            {
                battle.LeftList = new List <Character>()
                {
                    this._site.CurrentChar
                };
            }

            battle.LifeBefore = new Dictionary <string, int>();
            battle.LifeAfter  = new Dictionary <string, int>();
            if (lifeBeforeDict != null)
            {
                foreach (var p in lifeBeforeDict)
                {
                    battle.LifeBefore.Add(p.Key, p.Value);
                    battle.LifeAfter.Add(p.Key, p.Value);
                }
            }
            else
            {
                foreach (var p in battle.LeftList)
                {
                    battle.LifeBefore[p.Id] = p.Life;
                    battle.LifeAfter[p.Id]  = p.Life;
                }
            }
        }
        public override void Execute()
        {
            string no = GetQuery <string>("no");

            var army = this._site.InitArmyGroup();

            if (army != null)
            {
                this._site.ArmyGroupRemoveChar(no);

                foreach (var c in army.CharaInfoVoList)
                {
                    var gc = CharacterCache.GetCharByNo(c.CharaNo);
                    if (gc != null)
                    {
                        CharacterArmyGroupCache.ClearCache(gc.CharaId);
                    }
                }

                AllMapCache.ClearCache(this._site.CurrentCharId);
            }

            Response.WriteAsync(JsonUtil.Serialize(new { }));
        }