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(); }
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) { } } } }
private void GetAllocIncomeRelatedHeros(ref ListView <ActorRoot> relatedHeros, PoolObjHandle <ActorRoot> target, PoolObjHandle <ActorRoot> attacker, RES_INCOME_MEMBER_CHOOSE_TYPE chooseType, ResSoulExpAllocRule 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: { List <PoolObjHandle <ActorRoot> > list2 = Singleton <GameObjMgr> .instance.HeroActors; int num3 = list2.Count; for (int j = 0; j < num3; j++) { 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: { int num5 = target.handle.ActorControl.hurtSelfActorList.Count; for (int k = 0; k < num5; k++) { KeyValuePair <uint, ulong> pair = target.handle.ActorControl.hurtSelfActorList[k]; PoolObjHandle <ActorRoot> actor = Singleton <GameObjMgr> .GetInstance().GetActor(pair.Key); if ((actor != attacker) && ((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); } int num7 = target.handle.ActorControl.hurtSelfActorList.Count; for (int m = 0; m < num7; m++) { KeyValuePair <uint, ulong> pair2 = target.handle.ActorControl.hurtSelfActorList[m]; PoolObjHandle <ActorRoot> handle2 = Singleton <GameObjMgr> .GetInstance().GetActor(pair2.Key); 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; } } }