Beispiel #1
0
        private void OnActorDeadIncomeSoul(ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker)
        {
            if (!target || !attacker)
            {
                return;
            }
            ResIncomeAllocRule resIncomeAllocRule = null;

            switch (target.get_handle().TheActorMeta.ActorType)
            {
            case ActorTypeDef.Actor_Type_Hero:
                resIncomeAllocRule = this.m_incomeAllocRules[1][3];
                break;

            case ActorTypeDef.Actor_Type_Monster:
            {
                MonsterWrapper monsterWrapper = target.get_handle().AsMonster();
                if (monsterWrapper != null)
                {
                    RES_MONSTER_TYPE bMonsterType = monsterWrapper.cfgInfo.bMonsterType;
                    if (bMonsterType == 2)
                    {
                        resIncomeAllocRule = this.m_incomeAllocRules[1][4];
                    }
                    else if (bMonsterType == 1)
                    {
                        resIncomeAllocRule = this.m_incomeAllocRules[1][2];
                    }
                }
                break;
            }

            case ActorTypeDef.Actor_Type_Organ:
                resIncomeAllocRule = this.m_incomeAllocRules[1][1];
                break;

            case ActorTypeDef.Actor_Type_EYE:
                resIncomeAllocRule = this.m_incomeAllocRules[1][6];
                break;
            }
            if (resIncomeAllocRule != null)
            {
                ResDT_IncomeAttackRule incomeAllocRuleByAtker = this.GetIncomeAllocRuleByAtker(ref attacker, resIncomeAllocRule);
                if (incomeAllocRuleByAtker != null)
                {
                    this.AllocIncome(ref target, ref attacker, incomeAllocRuleByAtker, enIncomeType.Soul, resIncomeAllocRule.IncomeChangeRate, resIncomeAllocRule.iComputerChangeRate);
                }
            }
        }
        private void AllocIncomeToHeros(ref List <stActorIncome> actorIncomes, ListView <ActorRoot> relatedHeros, ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker, enIncomeType incomeType, uint incomeValue, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex, int[] soulExpIncomeChangeRate, int computerChangeRate)
        {
            int count = relatedHeros.Count;

            if (count <= 0)
            {
                return;
            }
            ResDT_AllocRuleParam resDT_AllocRuleParam = allocIncomeRule.astIncomeMemberArr[paramIndex];
            int num  = ((count > 5) ? 5 : count) - 1;
            int num2 = soulExpIncomeChangeRate[num];

            incomeValue = (uint)((ulong)((uint)((ulong)incomeValue * (ulong)((long)num2) / 10000uL)) * (ulong)((long)resDT_AllocRuleParam.iIncomeRate) / 10000uL);
            uint num3 = 0u;

            if (resDT_AllocRuleParam.wDivideType == 1)
            {
                num3 = (uint)((ulong)incomeValue / (ulong)((long)count));
            }
            else if (resDT_AllocRuleParam.wDivideType == 2)
            {
                num3 = incomeValue;
            }
            for (int i = 0; i < count; i++)
            {
                uint num4 = num3;
                if (incomeType == enIncomeType.Soul)
                {
                    if (relatedHeros[i] == attacker.handle)
                    {
                        num4 = (uint)((ulong)num3 * (ulong)((long)(10000 + relatedHeros[i].BuffHolderComp.GetSoulExpAddRate(target))) / 10000uL);
                    }
                }
                else if (incomeType == enIncomeType.GoldCoinInBattle)
                {
                    if (relatedHeros[i] == attacker.handle)
                    {
                        num4 = (uint)((ulong)num3 * (ulong)((long)(10000 + relatedHeros[i].BuffHolderComp.GetCoinAddRate(target, true))) / 10000uL);
                    }
                    else
                    {
                        num4 = (uint)((ulong)num3 * (ulong)((long)(10000 + relatedHeros[i].BuffHolderComp.GetCoinAddRate(target, false))) / 10000uL);
                    }
                }
                this.PutActorToIncomeList(ref actorIncomes, relatedHeros[i], incomeType, num4);
                if (incomeType == enIncomeType.Soul)
                {
                    AddSoulExpEventParam addSoulExpEventParam = new AddSoulExpEventParam(target, relatedHeros[i].SelfPtr, (int)num4);
                    Singleton <GameEventSys> .instance.SendEvent <AddSoulExpEventParam>(GameEventDef.Event_AddExpValue, ref addSoulExpEventParam);
                }
                else if (incomeType == enIncomeType.GoldCoinInBattle)
                {
                }
            }
        }
        private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex)
        {
            switch (chooseType)
            {
            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_CAMP:
            {
                List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .instance.HeroActors;
                int count = heroActors.get_Count();
                for (int i = 0; i < count; i++)
                {
                    if (heroActors.get_Item(i).handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp && heroActors.get_Item(i).handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!heroActors.get_Item(i).handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(heroActors.get_Item(i).handle);
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_RANGE:
            {
                if (attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.handle);
                }
                List <Player> allPlayers = Singleton <GamePlayerCenter> .instance.GetAllPlayers();

                if (allPlayers != null)
                {
                    int count2 = allPlayers.get_Count();
                    for (int j = 0; j < count2; j++)
                    {
                        if (!(allPlayers.get_Item(j).Captain == attacker) && allPlayers.get_Item(j).Captain.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp && this.IsActorInRange(allPlayers.get_Item(j).Captain, target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius) && (!allPlayers.get_Item(j).Captain.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                        {
                            if (allPlayers.get_Item(j).Captain.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Call)
                            {
                                CallActorWrapper callActorWrapper = allPlayers.get_Item(j).Captain.handle.ActorControl as CallActorWrapper;
                                if (callActorWrapper != null)
                                {
                                    relatedHeros.Add(callActorWrapper.GetHostActor());
                                }
                            }
                            else
                            {
                                relatedHeros.Add(allPlayers.get_Item(j).Captain.handle);
                            }
                        }
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_LAST_KILL:
                if (attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.handle);
                }
                break;

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ASSIST:
            {
                HashSet <uint>             assistSet  = BattleLogic.GetAssistSet(target, attacker, true);
                HashSet <uint> .Enumerator enumerator = assistSet.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator.get_Current());

                    if (actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!actor.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(actor.handle);
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ALL_KILL:
            {
                if (attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.handle);
                }
                HashSet <uint>             assistSet2  = BattleLogic.GetAssistSet(target, attacker, true);
                HashSet <uint> .Enumerator enumerator2 = assistSet2.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor2 = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator2.get_Current());

                    if (actor2.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && !relatedHeros.Contains(actor2.handle) && (!actor2.handle.ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(actor2.handle);
                    }
                }
                break;
            }
            }
        }
        private void AllocIncome(ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker, ResDT_IncomeAttackRule allocIncomeRule, enIncomeType incomeType, int[] soulExpIncomeChangeRate, int computerChangeRate)
        {
            uint actorKilledIncome = this.GetActorKilledIncome(ref target, incomeType);

            this.m_actorIncomes.Clear();
            for (int i = 0; i < allocIncomeRule.astIncomeMemberArr.Length; i++)
            {
                this.m_allocIncomeRelatedHeros.Clear();
                RES_INCOME_MEMBER_CHOOSE_TYPE wMemberChooseType = (RES_INCOME_MEMBER_CHOOSE_TYPE)allocIncomeRule.astIncomeMemberArr[i].wMemberChooseType;
                this.GetAllocIncomeRelatedHeros(ref this.m_allocIncomeRelatedHeros, ref target, ref attacker, wMemberChooseType, allocIncomeRule, i);
                this.AllocIncomeToHeros(ref this.m_actorIncomes, this.m_allocIncomeRelatedHeros, ref target, ref attacker, incomeType, actorKilledIncome, allocIncomeRule, i, soulExpIncomeChangeRate, computerChangeRate);
                this.m_allocIncomeRelatedHeros.Clear();
            }
            if (incomeType == enIncomeType.GoldCoinInBattle && target && target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
            {
                this.AllocGoldRewardToCamp(ref this.m_actorIncomes, ref attacker, ref target);
            }
            for (int j = 0; j < this.m_actorIncomes.get_Count(); j++)
            {
                if (this.m_actorIncomes.get_Item(j).m_actorRoot != null && this.m_actorIncomes.get_Item(j).m_actorRoot.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
                {
                    uint num = this.m_actorIncomes.get_Item(j).m_incomeValue;
                    if (incomeType == enIncomeType.Soul && IncomeControl.m_isExpCompensate)
                    {
                        num = IncomeControl.GetCompensateExp(this.m_actorIncomes.get_Item(j).m_actorRoot, this.m_actorIncomes.get_Item(j).m_incomeValue);
                    }
                    if (incomeType == enIncomeType.Soul)
                    {
                        if (target && target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster)
                        {
                            num = num * (uint)(10000 + Singleton <BattleLogic> .GetInstance().organControl.GetSoldierDropExpAddByOrgan(target.handle.TheActorMeta.ActorCamp)) / 10000u;
                        }
                        this.m_actorIncomes.get_Item(j).m_actorRoot.ValueComponent.AddSoulExp((int)num, false, AddSoulType.Income);
                    }
                    else if (incomeType == enIncomeType.GoldCoinInBattle)
                    {
                        if (target && target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster)
                        {
                            num = num * (uint)(10000 + Singleton <BattleLogic> .GetInstance().organControl.GetSoldierDropCoinAddByOrgan(target.handle.TheActorMeta.ActorCamp)) / 10000u;
                        }
                        bool isLastHit = object.ReferenceEquals(attacker.handle, this.m_actorIncomes.get_Item(j).m_actorRoot);
                        this.m_actorIncomes.get_Item(j).m_actorRoot.ValueComponent.ChangeGoldCoinInBattle((int)num, true, true, target.handle.myTransform.position, isLastHit, target);
                    }
                    if (incomeType == enIncomeType.Soul && this.m_actorIncomes.get_Item(j).m_actorRoot.IsHostCamp() && num > 0u)
                    {
                        Singleton <CBattleSystem> .GetInstance().CreateBattleFloatDigit((int)num, DIGIT_TYPE.ReceiveSpirit, this.m_actorIncomes.get_Item(j).m_actorRoot.gameObject.transform.position);
                    }
                }
            }
            this.m_actorIncomes.Clear();
        }
        private void OnActorDeadIncomeGoldCoinInBattle(ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker)
        {
            if (!target || !attacker)
            {
                return;
            }
            if (ActorHelper.IsHostCtrlActor(ref attacker) && (target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster || target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero))
            {
                if (attacker.handle.EffectControl != null)
                {
                    attacker.handle.EffectControl.PlayDyingGoldEffect(target);
                }
                Singleton <CSoundManager> .GetInstance().PlayBattleSound("Glod_Get", target, target.handle.gameObject);
            }
            ResIncomeAllocRule resIncomeAllocRule = null;

            switch (target.handle.TheActorMeta.ActorType)
            {
            case ActorTypeDef.Actor_Type_Hero:
                resIncomeAllocRule = this.m_incomeAllocRules[2][3];
                break;

            case ActorTypeDef.Actor_Type_Monster:
            {
                MonsterWrapper monsterWrapper = target.handle.AsMonster();
                if (monsterWrapper != null)
                {
                    RES_MONSTER_TYPE bMonsterType = (RES_MONSTER_TYPE)monsterWrapper.cfgInfo.bMonsterType;
                    if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_JUNGLE)
                    {
                        byte actorSubSoliderType = monsterWrapper.GetActorSubSoliderType();
                        if (actorSubSoliderType == 7 || actorSubSoliderType == 8 || actorSubSoliderType == 9)
                        {
                            resIncomeAllocRule = this.m_incomeAllocRules[2][5];
                        }
                        else if (actorSubSoliderType == 15)
                        {
                            resIncomeAllocRule = this.m_incomeAllocRules[2][7];
                        }
                        else
                        {
                            resIncomeAllocRule = this.m_incomeAllocRules[2][4];
                        }
                    }
                    else if (bMonsterType == RES_MONSTER_TYPE.RES_MONSTER_TYPE_SOLDIERLINE)
                    {
                        resIncomeAllocRule = this.m_incomeAllocRules[2][2];
                    }
                }
                break;
            }

            case ActorTypeDef.Actor_Type_Organ:
                resIncomeAllocRule = this.m_incomeAllocRules[2][1];
                break;

            case ActorTypeDef.Actor_Type_EYE:
                resIncomeAllocRule = this.m_incomeAllocRules[2][6];
                break;
            }
            if (resIncomeAllocRule != null)
            {
                ResDT_IncomeAttackRule incomeAllocRuleByAtker = this.GetIncomeAllocRuleByAtker(ref attacker, resIncomeAllocRule);
                if (incomeAllocRuleByAtker != null)
                {
                    this.AllocIncome(ref target, ref attacker, incomeAllocRuleByAtker, enIncomeType.GoldCoinInBattle, resIncomeAllocRule.IncomeChangeRate, resIncomeAllocRule.iComputerChangeRate);
                }
            }
        }
Beispiel #6
0
        private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, ref PoolObjHandle <ActorRoot> target, ref PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex)
        {
            switch (chooseType)
            {
            case 1:
            {
                List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .get_instance().HeroActors;

                int count = heroActors.get_Count();
                for (int i = 0; i < count; i++)
                {
                    if (heroActors.get_Item(i).get_handle().TheActorMeta.ActorCamp == attacker.get_handle().TheActorMeta.ActorCamp&& heroActors.get_Item(i).get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!heroActors.get_Item(i).get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(heroActors.get_Item(i).get_handle());
                    }
                }
                break;
            }

            case 2:
            {
                if (attacker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.get_handle());
                }
                List <PoolObjHandle <ActorRoot> > heroActors2 = Singleton <GameObjMgr> .get_instance().HeroActors;

                int count2 = heroActors2.get_Count();
                for (int j = 0; j < count2; j++)
                {
                    if (!(heroActors2.get_Item(j) == attacker))
                    {
                        if (heroActors2.get_Item(j).get_handle().TheActorMeta.ActorCamp == attacker.get_handle().TheActorMeta.ActorCamp&& heroActors2.get_Item(j).get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && this.IsActorInRange(heroActors2.get_Item(j), target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius) && (!heroActors2.get_Item(j).get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                        {
                            relatedHeros.Add(heroActors2.get_Item(j).get_handle());
                        }
                    }
                }
                break;
            }

            case 3:
                if (attacker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.get_handle());
                }
                break;

            case 4:
            {
                HashSet <uint>             assistSet  = BattleLogic.GetAssistSet(target, attacker, true);
                HashSet <uint> .Enumerator enumerator = assistSet.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator.get_Current());

                    if (actor.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!actor.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(actor.get_handle());
                    }
                }
                break;
            }

            case 5:
            {
                if (attacker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && (!attacker.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                {
                    relatedHeros.Add(attacker.get_handle());
                }
                HashSet <uint>             assistSet2  = BattleLogic.GetAssistSet(target, attacker, true);
                HashSet <uint> .Enumerator enumerator2 = assistSet2.GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor2 = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator2.get_Current());

                    if (actor2.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero && !relatedHeros.Contains(actor2.get_handle()) && (!actor2.get_handle().ActorControl.IsDeadState || allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                    {
                        relatedHeros.Add(actor2.get_handle());
                    }
                }
                break;
            }
            }
        }
Beispiel #7
0
        private void AllocIncomeToHeros(ref List <stActorIncome> actorIncomes, ListView <ActorRoot> relatedHeros, PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, enIncomeType incomeType, uint incomeValue, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex, int[] soulExpIncomeChangeRate, int computerChangeRate)
        {
            int count = relatedHeros.Count;

            if (count > 0)
            {
                ResDT_AllocRuleParam param = allocIncomeRule.astIncomeMemberArr[paramIndex];
                int index = ((count <= 5) ? count : 5) - 1;
                int num3  = soulExpIncomeChangeRate[index];
                incomeValue = (uint)((((uint)((incomeValue * num3) / ((ulong)0x2710L))) * param.iIncomeRate) / ((ulong)0x2710L));
                uint num4 = 0;
                if (param.wDivideType == 1)
                {
                    num4 = (uint)(((ulong)incomeValue) / ((long)count));
                }
                else if (param.wDivideType == 2)
                {
                    num4 = incomeValue;
                }
                for (int i = 0; i < count; i++)
                {
                    uint num6 = num4;
                    if (incomeType == enIncomeType.Soul)
                    {
                        if (relatedHeros[i] == attacker.handle)
                        {
                            num6 = (uint)((num4 * (0x2710 + relatedHeros[i].BuffHolderComp.GetSoulExpAddRate(target))) / ((ulong)0x2710L));
                        }
                        Player player = Singleton <GamePlayerCenter> .instance.GetPlayer(relatedHeros[i].TheActorMeta.PlayerId);

                        Player hostPlayer = Singleton <GamePlayerCenter> .instance.GetHostPlayer();

                        if (((!Singleton <LobbyLogic> .instance.inMultiGame && Singleton <BattleLogic> .instance.GetCurLvelContext().IsMobaMode()) && ((player != null) && player.Computer)) && ((hostPlayer != null) && (player.PlayerCamp != hostPlayer.PlayerCamp)))
                        {
                            num6 = (uint)((num4 * computerChangeRate) / ((ulong)0x2710L));
                        }
                    }
                    else if ((incomeType == enIncomeType.GoldCoinInBattle) && (relatedHeros[i] == attacker.handle))
                    {
                        num6 = (uint)((num4 * (0x2710 + relatedHeros[i].BuffHolderComp.GetCoinAddRate(target))) / ((ulong)0x2710L));
                    }
                    this.PutActorToIncomeList(ref actorIncomes, relatedHeros[i], incomeType, num6);
                    if (incomeType == enIncomeType.Soul)
                    {
                        AddSoulExpEventParam prm = new AddSoulExpEventParam(target, attacker, (int)num6);
                        Singleton <GameEventSys> .instance.SendEvent <AddSoulExpEventParam>(GameEventDef.Event_AddExpValue, ref prm);
                    }
                    else if (incomeType == enIncomeType.GoldCoinInBattle)
                    {
                    }
                }
            }
        }
Beispiel #8
0
        private void AllocIncome(PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, ResDT_IncomeAttackRule allocIncomeRule, enIncomeType incomeType, int[] soulExpIncomeChangeRate, int computerChangeRate)
        {
            uint actorKilledIncome = this.GetActorKilledIncome(target, incomeType);

            this.m_actorIncomes.Clear();
            for (int i = 0; i < allocIncomeRule.astIncomeMemberArr.Length; i++)
            {
                this.m_allocIncomeRelatedHeros.Clear();
                RES_INCOME_MEMBER_CHOOSE_TYPE wMemberChooseType = (RES_INCOME_MEMBER_CHOOSE_TYPE)allocIncomeRule.astIncomeMemberArr[i].wMemberChooseType;
                this.GetAllocIncomeRelatedHeros(ref this.m_allocIncomeRelatedHeros, target, attacker, wMemberChooseType, allocIncomeRule, i);
                this.AllocIncomeToHeros(ref this.m_actorIncomes, this.m_allocIncomeRelatedHeros, target, attacker, incomeType, actorKilledIncome, allocIncomeRule, i, soulExpIncomeChangeRate, computerChangeRate);
                this.m_allocIncomeRelatedHeros.Clear();
            }
            for (int j = 0; j < this.m_actorIncomes.Count; j++)
            {
                stActorIncome income = this.m_actorIncomes[j];
                if (income.m_actorRoot != null)
                {
                    stActorIncome income2 = this.m_actorIncomes[j];
                    if (income2.m_actorRoot.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
                    {
                        stActorIncome income3     = this.m_actorIncomes[j];
                        uint          incomeValue = income3.m_incomeValue;
                        if ((incomeType == enIncomeType.Soul) && this.m_isExpCompensate)
                        {
                            stActorIncome income4 = this.m_actorIncomes[j];
                            stActorIncome income5 = this.m_actorIncomes[j];
                            incomeValue = this.GetCompensateExp(income4.m_actorRoot, income5.m_incomeValue);
                        }
                        if (incomeType == enIncomeType.Soul)
                        {
                            stActorIncome income6 = this.m_actorIncomes[j];
                            income6.m_actorRoot.ValueComponent.AddSoulExp((int)incomeValue, false, AddSoulType.Income);
                        }
                        else if (incomeType == enIncomeType.GoldCoinInBattle)
                        {
                            stActorIncome income7   = this.m_actorIncomes[j];
                            bool          isLastHit = object.ReferenceEquals(attacker.handle, income7.m_actorRoot);
                            stActorIncome income8   = this.m_actorIncomes[j];
                            income8.m_actorRoot.ValueComponent.ChangeGoldCoinInBattle((int)incomeValue, true, true, target.handle.gameObject.transform.position, isLastHit);
                        }
                        if (incomeType == enIncomeType.Soul)
                        {
                            stActorIncome income9 = this.m_actorIncomes[j];
                            if (income9.m_actorRoot.IsHostCamp() && (incomeValue > 0))
                            {
                                stActorIncome income10 = this.m_actorIncomes[j];
                                Singleton <CBattleSystem> .GetInstance().CreateBattleFloatDigit((int)incomeValue, DIGIT_TYPE.ReceiveSpirit, income10.m_actorRoot.gameObject.transform.position);
                            }
                        }
                    }
                }
            }
            this.m_actorIncomes.Clear();
        }
Beispiel #9
0
        private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResDT_IncomeAttackRule allocIncomeRule, int paramIndex)
        {
            switch (chooseType)
            {
            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_CAMP:
            {
                List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .instance.HeroActors;
                int count = heroActors.Count;
                for (int i = 0; i < count; i++)
                {
                    PoolObjHandle <ActorRoot> handle3 = heroActors[i];
                    if (handle3.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp)
                    {
                        PoolObjHandle <ActorRoot> handle4 = heroActors[i];
                        if (handle4.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
                        {
                            PoolObjHandle <ActorRoot> handle5 = heroActors[i];
                            if (!handle5.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                            {
                                PoolObjHandle <ActorRoot> handle6 = heroActors[i];
                                relatedHeros.Add(handle6.handle);
                            }
                        }
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_RANGE:
            {
                if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                {
                    relatedHeros.Add(attacker.handle);
                }
                List <PoolObjHandle <ActorRoot> > list2 = Singleton <GameObjMgr> .instance.HeroActors;
                int num3 = list2.Count;
                for (int j = 0; j < num3; j++)
                {
                    if (list2[j] != attacker)
                    {
                        PoolObjHandle <ActorRoot> handle7 = list2[j];
                        if (handle7.handle.TheActorMeta.ActorCamp == attacker.handle.TheActorMeta.ActorCamp)
                        {
                            PoolObjHandle <ActorRoot> handle8 = list2[j];
                            if ((handle8.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && this.IsActorInRange(list2[j], target, allocIncomeRule.astIncomeMemberArr[paramIndex].iRangeRadius))
                            {
                                PoolObjHandle <ActorRoot> handle9 = list2[j];
                                if (!handle9.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0))
                                {
                                    PoolObjHandle <ActorRoot> handle10 = list2[j];
                                    relatedHeros.Add(handle10.handle);
                                }
                            }
                        }
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_LAST_KILL:
                if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                {
                    relatedHeros.Add(attacker.handle);
                }
                break;

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ASSIST:
            {
                HashSet <uint> .Enumerator enumerator = BattleLogic.GetAssistSet(target, attacker, true).GetEnumerator();
                while (enumerator.MoveNext())
                {
                    PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator.Current);

                    if ((actor.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!actor.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                    {
                        relatedHeros.Add(actor.handle);
                    }
                }
                break;
            }

            case RES_INCOME_MEMBER_CHOOSE_TYPE.RES_INCOME_MEMBER_ALL_KILL:
            {
                if ((attacker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && (!attacker.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                {
                    relatedHeros.Add(attacker.handle);
                }
                HashSet <uint> .Enumerator enumerator2 = BattleLogic.GetAssistSet(target, attacker, true).GetEnumerator();
                while (enumerator2.MoveNext())
                {
                    PoolObjHandle <ActorRoot> handle2 = Singleton <GameObjMgr> .GetInstance().GetActor(enumerator2.Current);

                    if (((handle2.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) && !relatedHeros.Contains(handle2.handle)) && (!handle2.handle.ActorControl.IsDeadState || (allocIncomeRule.astIncomeMemberArr[paramIndex].bDeadAddIncome > 0)))
                    {
                        relatedHeros.Add(handle2.handle);
                    }
                }
                break;
            }
            }
        }