private bool IsBetterHero(ref SingleGameContext.Calc9SlotHeroData heroe1, ref SingleGameContext.Calc9SlotHeroData heroe2) { return(heroe1.ConfigId > 0u && !heroe1.selected && (heroe2.ConfigId == 0u || heroe2.selected || heroe1.Ability > heroe2.Ability || (heroe1.Ability == heroe2.Ability && heroe1.Level > heroe2.Level) || (heroe1.Ability == heroe2.Ability && heroe1.Level == heroe2.Level && heroe1.Quality >= heroe2.Quality))); }
private void Calc9SlotHeroStandingPosition(CSDT_BATTLE_PLAYER_BRIEF stBattlePlayer) { SingleGameContext.Calc9SlotHeroData[] array = new SingleGameContext.Calc9SlotHeroData[3]; IGameActorDataProvider actorDataProvider = Singleton <ActorDataCenter> .get_instance().GetActorDataProvider(GameActorDataProviderType.StaticLobbyDataProvider); ActorStaticData actorStaticData = default(ActorStaticData); ActorMeta actorMeta = default(ActorMeta); if (Singleton <CRoleInfoManager> .GetInstance().GetMasterRoleInfo() == null) { return; } int num = 0; while (num < stBattlePlayer.astFighter[0].astChoiceHero.Length && num < 3) { uint dwHeroID = stBattlePlayer.astFighter[0].astChoiceHero[num].stBaseInfo.stCommonInfo.dwHeroID; if (dwHeroID != 0u) { actorMeta.ConfigId = (int)dwHeroID; actorDataProvider.GetActorStaticData(ref actorMeta, ref actorStaticData); array[num].Level = 1u; array[num].Quality = 1; array[num].RecommendPos = actorStaticData.TheHeroOnlyInfo.RecommendStandPos; array[num].Ability = (uint)CHeroDataFactory.CreateHeroData(dwHeroID).combatEft; array[num].ConfigId = dwHeroID; array[num].selected = false; array[num].BornIndex = -1; } num++; } this.ImpCalc9SlotHeroStandingPosition(ref array); int num2 = 0; while (num2 < stBattlePlayer.astFighter[0].astChoiceHero.Length && num2 < 3) { stBattlePlayer.astFighter[0].astChoiceHero[num2].stHeroExtral.iHeroPos = array[num2].BornIndex; num2++; } int num3 = 0; while (num3 < stBattlePlayer.astFighter[1].astChoiceHero.Length && num3 < 3) { uint dwHeroID2 = stBattlePlayer.astFighter[1].astChoiceHero[num3].stBaseInfo.stCommonInfo.dwHeroID; if (dwHeroID2 != 0u) { actorMeta.ConfigId = (int)dwHeroID2; actorDataProvider.GetActorStaticData(ref actorMeta, ref actorStaticData); array[num3].Level = (uint)stBattlePlayer.astFighter[1].astChoiceHero[num3].stBaseInfo.stCommonInfo.wLevel; array[num3].Quality = (int)stBattlePlayer.astFighter[1].astChoiceHero[num3].stBaseInfo.stCommonInfo.stQuality.wQuality; array[num3].RecommendPos = actorStaticData.TheHeroOnlyInfo.RecommendStandPos; array[num3].Ability = (uint)CHeroDataFactory.CreateHeroData(dwHeroID2).combatEft; array[num3].ConfigId = dwHeroID2; array[num3].selected = false; array[num3].BornIndex = -1; } num3++; } this.ImpCalc9SlotHeroStandingPosition(ref array); int num4 = 0; while (num4 < stBattlePlayer.astFighter[1].astChoiceHero.Length && num4 < 3) { stBattlePlayer.astFighter[1].astChoiceHero[num4].stHeroExtral.iHeroPos = array[num4].BornIndex; num4++; } }