Esempio n. 1
0
        public override void BuildPacket()
        {
            PushIntoStack(_userMagicArray.Count);
            foreach (UserMagic userMagic in _userMagicArray)
            {
                MagicInfo  magicInfo = new ConfigCacheSet <MagicInfo>().FindKey(userMagic.MagicID);
                short      repostion = GeneralHelper.ReplacePostion(ContextUser.UserID, userMagic.MagicID);
                DataStruct ds        = new DataStruct();
                ds.PushIntoStack(userMagic.MagicID);
                ds.PushIntoStack(magicInfo == null ? string.Empty : magicInfo.MagicName.ToNotNullString());
                ds.PushIntoStack((short)userMagic.MagicLv);
                ds.PushIntoStack(userMagic.IsEnabled == false ? 0 : 1);
                ds.PushIntoStack(magicInfo == null ? string.Empty : magicInfo.MagicDesc.ToNotNullString());
                string      gridPostion = string.Empty;
                string[]    gridRanges  = new string[0];
                MagicLvInfo magicLv     = new ConfigCacheSet <MagicLvInfo>().FindKey(userMagic.MagicID, userMagic.MagicLv);
                if (magicLv != null)
                {
                    var userFunction = new GameDataCacheSet <UserFunction>().FindKey(ContextUser.UserID, FunctionEnum.ReplaceGeneral);
                    gridPostion = magicLv.GridRange;
                    if (magicLv.ReplacePostion > 0 && userFunction != null)
                    {
                        gridPostion = gridPostion.TrimEnd(',') + "," + magicLv.ReplacePostion;
                    }
                }
                gridRanges = gridPostion.Split(',');
                ds.PushIntoStack(gridRanges.Length);

                foreach (string gridRang in gridRanges)
                {
                    int          isDisplace   = repostion == gridRang.ToInt() ? 1 : 0;
                    UserEmbattle userEmbattle = new GameDataCacheSet <UserEmbattle>().FindKey(ContextUser.UserID, userMagic.MagicID, gridRang.ToShort());
                    UserGeneral  uGeneral     = new GameDataCacheSet <UserGeneral>().FindKey(ContextUser.UserID, userEmbattle == null ? 0 : userEmbattle.GeneralID);

                    DataStruct ds1 = new DataStruct();
                    ds1.PushIntoStack(uGeneral == null ? (short)0 : (short)1);
                    ds1.PushIntoStack(gridRang.ToShort());
                    ds1.PushIntoStack(uGeneral == null ? 0 : uGeneral.GeneralID);
                    ds1.PushIntoStack(uGeneral == null ? string.Empty : uGeneral.HeadID.ToNotNullString());
                    ds1.PushIntoStack((short)isDisplace);
                    ds1.PushShortIntoStack(uGeneral == null ? (short)0 : MathUtils.ToShort(uGeneral.GeneralQuality));
                    ds.PushIntoStack(ds1);
                }
                PushIntoStack(ds);
            }
            // 获取佣兵品质
            var generalInfoCacheSet = new ShareCacheStruct <GeneralInfo>();

            PushIntoStack(_userGeneralArray.Count);
            foreach (UserGeneral general in _userGeneralArray)
            {
                GeneralInfo generalInfo = generalInfoCacheSet.FindKey(general.GeneralID);
                DataStruct  ds          = new DataStruct();
                ds.PushIntoStack(general.GeneralID);
                ds.PushIntoStack(general.HeadID.ToNotNullString());
                ds.PushShortIntoStack(generalInfo == null ? (short)0 : MathUtils.ToShort(generalInfo.GeneralQuality));
                PushIntoStack(ds);
            }
        }
Esempio n. 2
0
        public override void BuildPacket()
        {
            this.PushIntoStack(userPlotCombat.IsWin.ToShort());
            this.PushIntoStack(userPlotCombat.Experience);
            this.PushIntoStack(prizeItems.Count);
            foreach (PrizeItemInfo prizeItem in prizeItems)
            {
                ItemBaseInfo item   = new ConfigCacheSet <ItemBaseInfo>().FindKey(prizeItem.ItemID);
                DataStruct   dsItem = new DataStruct();
                dsItem.PushIntoStack(item.ItemName.ToNotNullString());
                dsItem.PushIntoStack(item.HeadID.ToNotNullString());
                dsItem.PushIntoStack(item.QualityType.ToShort());
                dsItem.PushIntoStack(prizeItem.Num);

                PushIntoStack(dsItem);
            }
            //攻方阵形
            PushIntoStack(combatProcessList.AttackList.Count);
            foreach (CombatEmbattle combatEmbattle in combatProcessList.AttackList)
            {
                int        isAttWait = combatEmbattle.IsWait ? 1 : 0;
                var        general   = _cacheSetGeneral.FindKey(combatEmbattle.GeneralID);
                DataStruct dsItem    = new DataStruct();
                dsItem.PushIntoStack(combatEmbattle.GeneralID);
                dsItem.PushIntoStack(combatEmbattle.GeneralName.ToNotNullString());
                //dsItem.PushIntoStack(combatEmbattle.HeadID.ToNotNullString());
                dsItem.PushIntoStack(general == null ? string.Empty : general.BattleHeadID.ToNotNullString());
                dsItem.PushIntoStack(combatEmbattle.Position.ToShort());
                dsItem.PushIntoStack(combatEmbattle.LiveNum);
                dsItem.PushIntoStack(combatEmbattle.LiveMaxNum);
                dsItem.PushIntoStack(combatEmbattle.MomentumNum);
                dsItem.PushIntoStack(combatEmbattle.MaxMomentumNum);
                dsItem.PushIntoStack(combatEmbattle.AbilityID);
                dsItem.PushIntoStack(combatEmbattle.GeneralLv);
                dsItem.PushIntoStack((short)isAttWait);
                // 增加佣兵品质
                dsItem.PushShortIntoStack(general == null ? 0 : general.GeneralQuality.ToShort());


                PushIntoStack(dsItem);
            }
            //防方阵形
            PushIntoStack(combatProcessList.DefenseList.Count);
            foreach (CombatEmbattle combatEmbattle in combatProcessList.DefenseList)
            {
                int        isDefWait = combatEmbattle.IsWait ? 1 : 0;
                DataStruct dsItem    = new DataStruct();
                dsItem.PushIntoStack(combatEmbattle.GeneralID);
                dsItem.PushIntoStack(combatEmbattle.GeneralName.ToNotNullString());
                dsItem.PushIntoStack(combatEmbattle.HeadID.ToNotNullString());
                dsItem.PushIntoStack(combatEmbattle.Position.ToShort());
                dsItem.PushIntoStack(combatEmbattle.LiveNum);
                dsItem.PushIntoStack(combatEmbattle.LiveMaxNum);
                dsItem.PushIntoStack(combatEmbattle.MomentumNum);
                dsItem.PushIntoStack(combatEmbattle.MaxMomentumNum);
                dsItem.PushIntoStack(combatEmbattle.AbilityID);
                dsItem.PushIntoStack(combatEmbattle.GeneralLv);
                dsItem.PushIntoStack((short)isDefWait);
                // 增加佣兵品质
                var general = _cacheSetGeneral.FindKey(combatEmbattle.GeneralID);
                dsItem.PushShortIntoStack(general == null ? 0 : general.GeneralQuality.ToShort());

                PushIntoStack(dsItem);
            }
            //战斗过程
            PushIntoStack(combatProcessList.ProcessList.Count);
            foreach (CombatProcess combatProcess in combatProcessList.ProcessList)
            {
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(combatProcess.GeneralID);
                dsItem.PushIntoStack(combatProcess.LiveNum);
                dsItem.PushIntoStack(combatProcess.Momentum);
                dsItem.PushIntoStack(combatProcess.AttackTaget.ToShort());
                dsItem.PushIntoStack(combatProcess.AttackUnit.ToShort());
                dsItem.PushIntoStack(combatProcess.AbilityProperty.ToShort());
                dsItem.PushIntoStack(combatProcess.AttStatus.ToShort());
                dsItem.PushIntoStack(combatProcess.DamageNum);
                dsItem.PushIntoStack(combatProcess.AttEffectID.ToNotNullString());
                dsItem.PushIntoStack(combatProcess.TargetEffectID.ToNotNullString());
                dsItem.PushIntoStack(combatProcess.IsMove.ToShort());
                dsItem.PushIntoStack(combatProcess.Position.ToShort());
                dsItem.PushIntoStack(combatProcess.Role.ToShort());


                dsItem.PushIntoStack(combatProcess.DamageStatusList.Count);
                foreach (AbilityEffectStatus effectStatus in combatProcess.DamageStatusList)
                {
                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(effectStatus.AbilityType.ToShort());
                    dsItem1.PushIntoStack(effectStatus.DamageNum);
                    dsItem1.PushIntoStack(effectStatus.IsIncrease ? 1 : 0);

                    dsItem.PushIntoStack(dsItem1);
                }

                dsItem.PushIntoStack(combatProcess.TargetList.Count);
                foreach (TargetProcess targetProcess in combatProcess.TargetList)
                {
                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(targetProcess.GeneralID);
                    dsItem1.PushIntoStack(targetProcess.LiveNum);
                    dsItem1.PushIntoStack(targetProcess.Momentum);
                    dsItem1.PushIntoStack(targetProcess.DamageNum);
                    dsItem1.PushIntoStack(targetProcess.IsShanBi.ToShort());
                    dsItem1.PushIntoStack(targetProcess.IsGeDang.ToShort());
                    dsItem1.PushIntoStack(targetProcess.IsBack.ToShort());
                    dsItem1.PushIntoStack(targetProcess.IsMove.ToShort());
                    dsItem1.PushIntoStack(targetProcess.BackDamageNum);
                    dsItem1.PushIntoStack(targetProcess.TargetStatus.ToShort());
                    dsItem1.PushIntoStack(targetProcess.Position.ToShort());
                    dsItem1.PushIntoStack(targetProcess.Role.ToShort());
                    //目标中招效果
                    dsItem1.PushIntoStack(targetProcess.DamageStatusList.Count);
                    foreach (AbilityEffectStatus effectStatus in targetProcess.DamageStatusList)
                    {
                        DataStruct dsItem12 = new DataStruct();
                        dsItem12.PushIntoStack(effectStatus.AbilityType.ToShort());
                        dsItem12.PushIntoStack(effectStatus.IsIncrease ? 1 : 0);

                        dsItem1.PushIntoStack(dsItem12);
                    }

                    dsItem1.PushIntoStack(targetProcess.IsBaoji.ToShort());
                    dsItem1.PushIntoStack(targetProcess.TrumpStatusList.Count);
                    foreach (var item in targetProcess.TrumpStatusList)
                    {
                        DataStruct dsItem13 = new DataStruct();
                        dsItem13.PushIntoStack((short)item.AbilityID);
                        dsItem13.PushIntoStack(item.Num);
                        dsItem1.PushIntoStack(dsItem13);
                    }

                    dsItem.PushIntoStack(dsItem1);
                }
                dsItem.PushIntoStack(combatProcess.TrumpStatusList.Count);
                foreach (var item in combatProcess.TrumpStatusList)
                {
                    DataStruct dsItem14 = new DataStruct();
                    dsItem14.PushIntoStack((short)item.AbilityID);
                    dsItem14.PushIntoStack(item.Num);
                    dsItem.PushIntoStack(dsItem14);
                }
                dsItem.PushIntoStack(combatProcess.FntHeadID.ToNotNullString());
                dsItem.PushIntoStack(combatProcess.AbilityID);
                PushIntoStack(dsItem);
            }

            PushIntoStack(userPlotCombat.BlessExperience);
            PushIntoStack(GotoNum);
            PushIntoStack(selfAbilityEffectList.Count);
            foreach (var selfAbilityEffect in selfAbilityEffectList)
            {
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(selfAbilityEffect.GeneralID);
                dsItem.PushIntoStack(selfAbilityEffect.EffectID1.ToNotNullString());
                dsItem.PushIntoStack(selfAbilityEffect.FntHeadID.ToNotNullString());
                dsItem.PushIntoStack(selfAbilityEffect.IsIncrease ? 1.ToShort() : 0.ToShort());
                dsItem.PushIntoStack(selfAbilityEffect.Position);
                dsItem.PushIntoStack(selfAbilityEffect.Role.ToInt());
                PushIntoStack(dsItem);
            }
            PushIntoStack(_userTalPriority);
            PushIntoStack(_npcTalPriority);
        }
Esempio n. 3
0
        public override void BuildPacket()
        {
            this.PushIntoStack(IsWin.ToShort());
            this.PushIntoStack(bossProcess.DamageNum);
            this.PushIntoStack(bossProcess.ObtainNum);
            this.PushIntoStack(bossProcess.GameCoin);
            this.PushIntoStack(bossProcess.KillGameCoin);

            //攻方阵形
            this.PushIntoStack(bossProcess.ProcessContainer.AttackList.Count);
            foreach (CombatEmbattle combatEmbattle in bossProcess.ProcessContainer.AttackList)
            {
                var        general = _cacheSetGeneral.FindKey(combatEmbattle.GeneralID);
                DataStruct dsItem  = new DataStruct();
                dsItem.PushIntoStack(combatEmbattle.GeneralID);
                dsItem.PushIntoStack(combatEmbattle.GeneralName.ToNotNullString());
                dsItem.PushIntoStack(general == null ? string.Empty : general.BattleHeadID.ToNotNullString());
                //dsItem.PushIntoStack(combatEmbattle.BattleHead.ToNotNullString());
                dsItem.PushIntoStack(combatEmbattle.Position.ToShort());
                dsItem.PushIntoStack(combatEmbattle.LiveNum);
                dsItem.PushIntoStack(combatEmbattle.LiveMaxNum);
                dsItem.PushIntoStack(combatEmbattle.MomentumNum);
                dsItem.PushIntoStack(combatEmbattle.MaxMomentumNum);
                dsItem.PushIntoStack(combatEmbattle.AbilityID);
                dsItem.PushIntoStack(combatEmbattle.GeneralLv);
                dsItem.PushIntoStack(combatEmbattle.IsWait ? (short)1 : (short)0);
                // 增加佣兵品质
                dsItem.PushShortIntoStack(general == null ? 0 : general.GeneralQuality.ToShort());
                this.PushIntoStack(dsItem);
            }
            //防方阵形
            this.PushIntoStack(bossProcess.ProcessContainer.DefenseList.Count);
            foreach (CombatEmbattle combatEmbattle in bossProcess.ProcessContainer.DefenseList)
            {
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(combatEmbattle.GeneralID);
                dsItem.PushIntoStack(combatEmbattle.GeneralName.ToNotNullString());
                dsItem.PushIntoStack(combatEmbattle.HeadID.ToNotNullString());
                dsItem.PushIntoStack(combatEmbattle.Position.ToShort());
                dsItem.PushIntoStack(combatEmbattle.LiveNum);
                dsItem.PushIntoStack(combatEmbattle.LiveMaxNum);
                dsItem.PushIntoStack(combatEmbattle.MomentumNum);
                dsItem.PushIntoStack(combatEmbattle.MaxMomentumNum);
                dsItem.PushIntoStack(combatEmbattle.AbilityID);
                dsItem.PushIntoStack(combatEmbattle.GeneralLv);
                dsItem.PushIntoStack(combatEmbattle.IsWait ? (short)1 : (short)0);
                // 增加佣兵品质
                var general = _cacheSetGeneral.FindKey(combatEmbattle.GeneralID);
                dsItem.PushShortIntoStack(general == null ? 0 : general.GeneralQuality.ToShort());
                this.PushIntoStack(dsItem);
            }
            //战斗过程
            this.PushIntoStack(bossProcess.ProcessContainer.ProcessList.Count);
            foreach (CombatProcess combatProcess in bossProcess.ProcessContainer.ProcessList)
            {
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(combatProcess.GeneralID);
                dsItem.PushIntoStack(combatProcess.LiveNum);
                dsItem.PushIntoStack(combatProcess.Momentum);
                dsItem.PushIntoStack(combatProcess.AttackTaget.ToShort());
                dsItem.PushIntoStack(combatProcess.AttackUnit.ToShort());
                dsItem.PushIntoStack(combatProcess.AbilityProperty.ToShort());
                dsItem.PushIntoStack(combatProcess.AttStatus.ToShort());
                dsItem.PushIntoStack(combatProcess.DamageNum);
                dsItem.PushIntoStack(combatProcess.AttEffectID.ToNotNullString());
                dsItem.PushIntoStack(combatProcess.TargetEffectID.ToNotNullString());
                dsItem.PushIntoStack(combatProcess.IsMove.ToShort());
                dsItem.PushIntoStack(combatProcess.Position.ToShort());
                dsItem.PushIntoStack(combatProcess.Role.ToShort());

                dsItem.PushIntoStack(combatProcess.DamageStatusList.Count);
                foreach (AbilityEffectStatus effectStatus in combatProcess.DamageStatusList)
                {
                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(effectStatus.AbilityType.ToShort());
                    dsItem1.PushIntoStack(effectStatus.DamageNum);
                    dsItem1.PushIntoStack(effectStatus.IsIncrease ? 1 : 0);

                    dsItem.PushIntoStack(dsItem1);
                }

                dsItem.PushIntoStack(combatProcess.TargetList.Count);
                foreach (TargetProcess targetProcess in combatProcess.TargetList)
                {
                    DataStruct dsItem1 = new DataStruct();
                    dsItem1.PushIntoStack(targetProcess.GeneralID);
                    dsItem1.PushIntoStack(targetProcess.LiveNum);
                    dsItem1.PushIntoStack(targetProcess.Momentum);
                    dsItem1.PushIntoStack(targetProcess.DamageNum);
                    dsItem1.PushIntoStack(targetProcess.IsShanBi.ToShort());
                    dsItem1.PushIntoStack(targetProcess.IsGeDang.ToShort());
                    dsItem1.PushIntoStack(targetProcess.IsBack.ToShort());
                    dsItem1.PushIntoStack(targetProcess.IsMove.ToShort());
                    dsItem1.PushIntoStack(targetProcess.BackDamageNum);
                    dsItem1.PushIntoStack(targetProcess.TargetStatus.ToShort());
                    dsItem1.PushIntoStack(targetProcess.Position.ToShort());
                    dsItem1.PushIntoStack(targetProcess.Role.ToShort());
                    //目标中招效果
                    dsItem1.PushIntoStack(targetProcess.DamageStatusList.Count);
                    foreach (AbilityEffectStatus effectStatus in targetProcess.DamageStatusList)
                    {
                        DataStruct dsItem12 = new DataStruct();
                        dsItem12.PushIntoStack(effectStatus.AbilityType.ToShort());
                        dsItem12.PushIntoStack(effectStatus.IsIncrease ? 1 : 0);

                        dsItem1.PushIntoStack(dsItem12);
                    }
                    dsItem1.PushIntoStack(targetProcess.IsBaoji.ToShort());
                    dsItem1.PushIntoStack(targetProcess.TrumpStatusList.Count);
                    foreach (var item in targetProcess.TrumpStatusList)
                    {
                        DataStruct dsItem13 = new DataStruct();
                        dsItem13.PushIntoStack((short)item.AbilityID);
                        dsItem13.PushIntoStack(item.Num);
                        dsItem1.PushIntoStack(dsItem13);
                    }
                    dsItem.PushIntoStack(dsItem1);
                }
                dsItem.PushIntoStack(combatProcess.TrumpStatusList.Count);
                foreach (var item in combatProcess.TrumpStatusList)
                {
                    DataStruct dsItem14 = new DataStruct();
                    dsItem14.PushIntoStack((short)item.AbilityID);
                    dsItem14.PushIntoStack(item.Num);
                    dsItem.PushIntoStack(dsItem14);
                }
                dsItem.PushIntoStack(combatProcess.FntHeadID.ToNotNullString());
                this.PushIntoStack(dsItem);
            }
            PushIntoStack(selfAbilityEffectList.Count);
            foreach (var selfAbilityEffect in selfAbilityEffectList)
            {
                DataStruct dsItem = new DataStruct();
                dsItem.PushIntoStack(selfAbilityEffect.GeneralID);
                dsItem.PushIntoStack(selfAbilityEffect.EffectID1.ToNotNullString());
                dsItem.PushIntoStack(selfAbilityEffect.FntHeadID.ToNotNullString());
                dsItem.PushIntoStack(selfAbilityEffect.IsIncrease ? 1.ToShort() : 0.ToShort());
                dsItem.PushIntoStack(selfAbilityEffect.Position);
                dsItem.PushIntoStack(selfAbilityEffect.Role.ToInt());
                PushIntoStack(dsItem);
            }
            PushIntoStack(_userTalPriority);
            PushIntoStack(_npcTalPriority);
        }