public ResSoulAddition QueryIncomeAdditonInfo(int heroState)
        {
            int count = this.m_incomeAdditionList.Count;

            for (int i = 0; i < count; i++)
            {
                ResSoulAddition resSoulAddition = this.m_incomeAdditionList[i];
                if (resSoulAddition != null && resSoulAddition.iHeroKillType == heroState)
                {
                    return(resSoulAddition);
                }
            }
            return(null);
        }
        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);
        }
        private void AllocGoldRewardToCamp(ref List <stActorIncome> actorIncomes, ref PoolObjHandle <ActorRoot> attaker, ref PoolObjHandle <ActorRoot> target)
        {
            if (!attaker || !target)
            {
                return;
            }
            int             heroKillOrDeadState = this.GetHeroKillOrDeadState(ref target);
            ResSoulAddition resSoulAddition     = this.QueryIncomeAdditonInfo(heroKillOrDeadState);

            if (resSoulAddition != null && resSoulAddition.dwGoldRewardValue > 0u)
            {
                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 == attaker.handle.TheActorMeta.ActorCamp && heroActors.get_Item(i).handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)
                    {
                        this.PutActorToIncomeList(ref actorIncomes, heroActors.get_Item(i).handle, enIncomeType.GoldCoinInBattle, resSoulAddition.dwGoldRewardValue);
                    }
                }
            }
        }
        public void ResetIncomeAdditionList()
        {
            this.m_incomeAdditionList.Clear();
            SLevelContext curLvelContext = Singleton <BattleLogic> .instance.GetCurLvelContext();

            DebugHelper.Assert(curLvelContext != null);
            if (curLvelContext == null)
            {
                return;
            }
            if (!Singleton <BattleLogic> .instance.m_LevelContext.IsSoulGrow())
            {
                return;
            }
            uint             soulAllocId = curLvelContext.m_soulAllocId;
            int              mapID       = curLvelContext.m_mapID;
            HashSet <object> hashSet;

            if (soulAllocId > 0u)
            {
                hashSet = GameDataMgr.soulAdditionDatabin.GetDataByKey(soulAllocId);
            }
            else
            {
                hashSet = GameDataMgr.soulAdditionDatabin.GetDataByIndex(0);
            }
            if (hashSet != null)
            {
                HashSet <object> .Enumerator enumerator = hashSet.GetEnumerator();
                while (enumerator.MoveNext())
                {
                    ResSoulAddition resSoulAddition = enumerator.get_Current() as ResSoulAddition;
                    if (resSoulAddition != null)
                    {
                        this.m_incomeAdditionList.Add(resSoulAddition);
                    }
                }
            }
        }
Пример #5
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);
        }