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 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) { } } } }
private void OnAddExpValue(ref AddSoulExpEventParam prm) { this.m_stSoulStatisticInfo.iAddExpTotal += prm.iAddExpValue; if (prm.src != 0) { if ((prm.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) && (prm.src.handle.TheActorMeta.ActorCamp != COM_PLAYERCAMP.COM_PLAYERCAMP_MID)) { this.m_stSoulStatisticInfo.iKillSoldierExpMax = Math.Max(this.m_stSoulStatisticInfo.iKillSoldierExpMax, prm.iAddExpValue); } else if ((prm.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster) && (prm.src.handle.TheActorMeta.ActorCamp == COM_PLAYERCAMP.COM_PLAYERCAMP_MID)) { this.m_stSoulStatisticInfo.iKillMonsterExpMax = Math.Max(this.m_stSoulStatisticInfo.iKillMonsterExpMax, prm.iAddExpValue); } else if (prm.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { this.m_stSoulStatisticInfo.iKillHeroExpMax = Math.Max(this.m_stSoulStatisticInfo.iKillHeroExpMax, prm.iAddExpValue); } else if (prm.src.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { this.m_stSoulStatisticInfo.iKillOrganExpMax = Math.Max(this.m_stSoulStatisticInfo.iKillOrganExpMax, prm.iAddExpValue); } } if ((prm.atker != 0) && (prm.atker.handle.TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero)) { ValueProperty valueComponent = prm.atker.handle.ValueComponent; if ((valueComponent != null) && (valueComponent.ObjValueStatistic != null)) { uint num2 = (uint)(Singleton <FrameSynchr> .instance.LogicFrameTick - valueComponent.ObjValueStatistic.ulLastAddSoulExpTime); valueComponent.ObjValueStatistic.uiAddSoulExpIntervalMax = (valueComponent.ObjValueStatistic.uiAddSoulExpIntervalMax <= num2) ? num2 : valueComponent.ObjValueStatistic.uiAddSoulExpIntervalMax; } List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .instance.HeroActors; for (int i = 0; i < heroActors.Count; i++) { PoolObjHandle <ActorRoot> handle = heroActors[i]; if (handle.handle.TheActorMeta.ActorCamp == prm.atker.handle.TheActorMeta.ActorCamp) { PoolObjHandle <ActorRoot> handle2 = heroActors[i]; if (handle2.handle.ValueComponent != null) { PoolObjHandle <ActorRoot> handle3 = heroActors[i]; if (handle3.handle.ValueComponent.ObjValueStatistic != null) { PoolObjHandle <ActorRoot> handle4 = heroActors[i]; handle4.handle.ValueComponent.ObjValueStatistic.uiTeamSoulExpTotal += (uint)prm.iAddExpValue; } } } } } }
private void OnAddExpValue(ref AddSoulExpEventParam prm) { this.m_stSoulStatisticInfo.iAddExpTotal += prm.iAddExpValue; if (prm.src) { if (prm.src.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster && prm.src.get_handle().TheActorMeta.ActorCamp != null) { this.m_stSoulStatisticInfo.iKillSoldierExpMax = Math.Max(this.m_stSoulStatisticInfo.iKillSoldierExpMax, prm.iAddExpValue); } else if (prm.src.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Monster && prm.src.get_handle().TheActorMeta.ActorCamp == null) { this.m_stSoulStatisticInfo.iKillMonsterExpMax = Math.Max(this.m_stSoulStatisticInfo.iKillMonsterExpMax, prm.iAddExpValue); } else if (prm.src.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { this.m_stSoulStatisticInfo.iKillHeroExpMax = Math.Max(this.m_stSoulStatisticInfo.iKillHeroExpMax, prm.iAddExpValue); } else if (prm.src.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Organ) { this.m_stSoulStatisticInfo.iKillOrganExpMax = Math.Max(this.m_stSoulStatisticInfo.iKillOrganExpMax, prm.iAddExpValue); } } if (prm.atker && prm.atker.get_handle().TheActorMeta.ActorType == ActorTypeDef.Actor_Type_Hero) { ValueProperty valueComponent = prm.atker.get_handle().ValueComponent; if (valueComponent != null && valueComponent.ObjValueStatistic != null) { ulong logicFrameTick = Singleton <FrameSynchr> .get_instance().LogicFrameTick; uint num = (uint)(logicFrameTick - valueComponent.ObjValueStatistic.ulLastAddSoulExpTime); valueComponent.ObjValueStatistic.uiAddSoulExpIntervalMax = ((valueComponent.ObjValueStatistic.uiAddSoulExpIntervalMax <= num) ? num : valueComponent.ObjValueStatistic.uiAddSoulExpIntervalMax); } List <PoolObjHandle <ActorRoot> > heroActors = Singleton <GameObjMgr> .get_instance().HeroActors; for (int i = 0; i < heroActors.get_Count(); i++) { if (heroActors.get_Item(i).get_handle().TheActorMeta.ActorCamp == prm.atker.get_handle().TheActorMeta.ActorCamp&& heroActors.get_Item(i).get_handle().ValueComponent != null && heroActors.get_Item(i).get_handle().ValueComponent.ObjValueStatistic != null) { heroActors.get_Item(i).get_handle().ValueComponent.ObjValueStatistic.uiTeamSoulExpTotal += (uint)prm.iAddExpValue; } } } }