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)
                {
                }
            }
        }
Beispiel #2
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)
                    {
                    }
                }
            }
        }