public uint GetHeroKilledIncome(ref PoolObjHandle <ActorRoot> target, enIncomeType incomeType)
        {
            if (!target)
            {
                return(0u);
            }
            int             heroKillOrDeadState = this.GetHeroKillOrDeadState(ref target);
            ResSoulAddition resSoulAddition     = this.QueryIncomeAdditonInfo(heroKillOrDeadState);
            int             num = 10000;

            if (resSoulAddition != null)
            {
                if (incomeType == enIncomeType.Soul)
                {
                    num = resSoulAddition.iExpAddRate;
                }
                else if (incomeType == enIncomeType.GoldCoinInBattle)
                {
                    num = resSoulAddition.iGoldCoinInBattleAddRate;
                }
            }
            int actorSoulLevel = target.handle.ValueComponent.actorSoulLevel;
            ResSoulLvlUpInfo resSoulLvlUpInfo = this.QuerySoulLvlUpInfo((uint)actorSoulLevel);
            uint             num2             = 0u;
            uint             num3             = 0u;

            if (resSoulLvlUpInfo != null)
            {
                if (incomeType == enIncomeType.Soul)
                {
                    num2 = resSoulLvlUpInfo.dwKilledExp;
                    num3 = resSoulLvlUpInfo.dwExtraKillExp;
                }
                else if (incomeType == enIncomeType.GoldCoinInBattle)
                {
                    num2 = (uint)resSoulLvlUpInfo.wKillGoldCoinInBattle;
                    num3 = (uint)resSoulLvlUpInfo.wExtraKillGoldCoinInBattle;
                }
            }
            uint num4 = (uint)((ulong)num2 * (ulong)((long)num) / 10000uL);

            if (Singleton <BattleStatistic> .instance.GetCampScore(COM_PLAYERCAMP.COM_PLAYERCAMP_1) + Singleton <BattleStatistic> .instance.GetCampScore(COM_PLAYERCAMP.COM_PLAYERCAMP_2) == 1)
            {
                num4 += num3;
            }
            return(num4);
        }
Exemplo n.º 2
0
 private uint GetActorKilledIncome(PoolObjHandle <ActorRoot> target, enIncomeType incomeType)
 {
     if (target != 0)
     {
         if (target.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
         {
             return(this.GetHeroKilledIncome((HeroWrapper)target.handle.ActorControl, incomeType));
         }
         if (incomeType == enIncomeType.Soul)
         {
             return(Singleton <BattleLogic> .GetInstance().dynamicProperty.GetDynamicSoulExp(target.handle.TheStaticData.TheBaseAttribute.DynamicProperty, target.handle.TheStaticData.TheBaseAttribute.SoulExpGained));
         }
         if (incomeType == enIncomeType.GoldCoinInBattle)
         {
             return(Singleton <BattleLogic> .GetInstance().dynamicProperty.GetDynamicGoldCoinInBattle(target.handle.TheStaticData.TheBaseAttribute.DynamicProperty, target.handle.TheStaticData.TheBaseAttribute.GoldCoinInBattleGained, target.handle.TheStaticData.TheBaseAttribute.GoldCoinInBattleGainedFloatRange));
         }
     }
     return(0);
 }
        private void PutActorToIncomeList(ref List <stActorIncome> actorIncomes, ActorRoot actorRoot, enIncomeType incomeType, uint incomeValue)
        {
            stActorIncome stActorIncome = default(stActorIncome);

            for (int i = 0; i < actorIncomes.get_Count(); i++)
            {
                if (actorIncomes.get_Item(i).m_actorRoot == actorRoot)
                {
                    stActorIncome.m_actorRoot   = actorRoot;
                    stActorIncome.m_incomeType  = incomeType;
                    stActorIncome.m_incomeValue = actorIncomes.get_Item(i).m_incomeValue + incomeValue;
                    actorIncomes.set_Item(i, stActorIncome);
                    return;
                }
            }
            stActorIncome.m_actorRoot   = actorRoot;
            stActorIncome.m_incomeType  = incomeType;
            stActorIncome.m_incomeValue = incomeValue;
            actorIncomes.Add(stActorIncome);
        }
        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 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();
        }
Exemplo n.º 6
0
        private void AllocIncomeToHeros(ref List <stActorIncome> actorIncomes, ListView <ActorRoot> relatedHeros, PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, enIncomeType incomeType, uint incomeValue, ResSoulExpAllocRule allocIncomeRule, int paramIndex)
        {
            int count = relatedHeros.Count;

            if (count > 0)
            {
                ResDT_AllocRuleParam param = allocIncomeRule.astIncomeMemberArr[paramIndex];
                int index = ((count <= 5) ? count : 5) - 1;
                int num3  = allocIncomeRule.IncomeChangeRate[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().isPVPLevel) && ((player != null) && player.Computer)) && ((hostPlayer != null) && (player.PlayerCamp != hostPlayer.PlayerCamp)))
                        {
                            num6 = (uint)((num4 * allocIncomeRule.iComputerChangeRate) / ((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)
                    {
                    }
                }
            }
        }
Exemplo n.º 7
0
        public uint GetHeroKilledIncome(HeroWrapper heroWrapper, enIncomeType incomeType)
        {
            if (heroWrapper == null)
            {
                return(0);
            }
            int             key       = 0;
            ResSoulAddition dataByKey = null;

            if (heroWrapper.ContiKillNum > 0)
            {
                if (heroWrapper.ContiKillNum >= 7)
                {
                    key = 7;
                }
                else
                {
                    key = heroWrapper.ContiKillNum;
                }
                dataByKey = GameDataMgr.soulAdditionDatabin.GetDataByKey(key);
            }
            else
            {
                if (heroWrapper.ContiDeadNum >= 7)
                {
                    key = -7;
                }
                else
                {
                    key = -heroWrapper.ContiDeadNum;
                }
                dataByKey = GameDataMgr.soulAdditionDatabin.GetDataByKey(key);
            }
            int iExpAddRate = 0x2710;

            if (dataByKey != null)
            {
                if (incomeType == enIncomeType.Soul)
                {
                    iExpAddRate = dataByKey.iExpAddRate;
                }
                else if (incomeType == enIncomeType.GoldCoinInBattle)
                {
                    iExpAddRate = dataByKey.iGoldCoinInBattleAddRate;
                }
            }
            int actorSoulLevel              = heroWrapper.actor.ValueComponent.actorSoulLevel;
            ResSoulLvlUpInfo info           = this.QuerySoulLvlUpInfo((uint)actorSoulLevel);
            uint             dwKilledExp    = 0;
            uint             dwExtraKillExp = 0;

            if (info != null)
            {
                if (incomeType == enIncomeType.Soul)
                {
                    dwKilledExp    = info.dwKilledExp;
                    dwExtraKillExp = info.dwExtraKillExp;
                }
                else if (incomeType == enIncomeType.GoldCoinInBattle)
                {
                    dwKilledExp    = info.wKillGoldCoinInBattle;
                    dwExtraKillExp = info.wExtraKillGoldCoinInBattle;
                }
            }
            uint num8 = (uint)((dwKilledExp * iExpAddRate) / ((ulong)0x2710L));

            if ((Singleton <BattleStatistic> .instance.GetCampScore(COM_PLAYERCAMP.COM_PLAYERCAMP_1) + Singleton <BattleStatistic> .instance.GetCampScore(COM_PLAYERCAMP.COM_PLAYERCAMP_2)) == 1)
            {
                num8 += dwExtraKillExp;
            }
            return(num8);
        }
Exemplo n.º 8
0
        private void AllocIncome(PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, ResSoulExpAllocRule allocIncomeRule, enIncomeType incomeType)
        {
            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);
                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];
                            income7.m_actorRoot.ValueComponent.ChangeGoldCoinInBattle((int)incomeValue, true, true, target.handle.gameObject.transform.position);
                        }
                        if (incomeType == enIncomeType.Soul)
                        {
                            stActorIncome income8 = this.m_actorIncomes[j];
                            if (income8.m_actorRoot.IsHostCamp() && (incomeValue > 0))
                            {
                                stActorIncome income9 = this.m_actorIncomes[j];
                                Singleton <CBattleSystem> .GetInstance().CreateBattleFloatDigit((int)incomeValue, DIGIT_TYPE.ReceiveSpirit, income9.m_actorRoot.gameObject.transform.position);
                            }
                        }
                    }
                }
            }
            this.m_actorIncomes.Clear();
        }