// Token: 0x0600497E RID: 18814 RVA: 0x0016ED68 File Offset: 0x0016CF68 public void ApplyTrainingTechToHero(Hero hero, TrainingTech tech) { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_ApplyTrainingTechToHeroHeroTrainingTech_hotfix != null) { this.m_ApplyTrainingTechToHeroHeroTrainingTech_hotfix.call(new object[] { this, hero, tech }); return; } BJLuaObjHelper.IsSkipLuaHotfix = false; if (tech == null || tech.Level == 0) { return; } ConfigDataHeroInfo configDataHeroInfo = this.m_configDataLoader.GetConfigDataHeroInfo(hero.HeroId); if (configDataHeroInfo == null) { return; } TrainingTechInfo trainingTechInfo = tech.Infos[tech.Level - 1]; if (configDataHeroInfo.TechCanLearnSoldiers_ID.Contains(trainingTechInfo.SoldierIDUnlocked) && !hero.HasOwnSoldier(trainingTechInfo.SoldierIDUnlocked)) { this.m_hero.AddSoldier(hero, trainingTechInfo.SoldierIDUnlocked, true); } }
// Token: 0x0600497A RID: 18810 RVA: 0x0016E8F0 File Offset: 0x0016CAF0 public TrainingTechResourceRequirements GetTechLevelupResourceRequirements(int TechId, int DeltaLevel = 1) { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_GetTechLevelupResourceRequirementsInt32Int32_hotfix != null) { return((TrainingTechResourceRequirements)this.m_GetTechLevelupResourceRequirementsInt32Int32_hotfix.call(new object[] { this, TechId, DeltaLevel })); } BJLuaObjHelper.IsSkipLuaHotfix = false; TrainingTech tech = this.m_trainingGroundDS.GetTech(TechId); if (DeltaLevel < 1) { return(null); } int level = tech.Level; if (!this.CanLevelup(TechId, DeltaLevel)) { return(null); } TrainingTechResourceRequirements trainingTechResourceRequirements = this.GetResourceRequirementsByLevel(TechId, tech.Level + 1); int num = tech.Level + 2; while (num < this.GetTechMaxLevel(TechId) && num < tech.Level + DeltaLevel) { trainingTechResourceRequirements += this.GetResourceRequirementsByLevel(TechId, num); num++; } return(trainingTechResourceRequirements); }
// Token: 0x06003B3F RID: 15167 RVA: 0x0010F144 File Offset: 0x0010D344 public static BusinessCard FromProtocol(ProBusinessCard pbBusinessCard) { BusinessCard businessCard = new BusinessCard(); businessCard.UserId = pbBusinessCard.UserId; businessCard.HeadIcon = pbBusinessCard.HeadIcon; businessCard.Name = pbBusinessCard.Name; businessCard.Level = pbBusinessCard.Level; businessCard.ArenaPoints = pbBusinessCard.ArenaPoints; businessCard.Likes = pbBusinessCard.Likes; businessCard.IsOnLine = pbBusinessCard.IsOnLine; businessCard.SetInfo = BusinessCardInfoSet.FromProtocol(pbBusinessCard.SetInfo); businessCard.StatisticalData = BusinessCardStatisticalData.FromProtocol(pbBusinessCard.StatisticalData); foreach (ProBattleHero pbBattleHero in pbBusinessCard.Heroes) { businessCard.Heroes.Add(BattleHero.PBBattleHeroToBattleHero(pbBattleHero)); } foreach (ProBattleHero pbBattleHero2 in pbBusinessCard.MostSkilledHeroes) { businessCard.MostSkilledHeroes.Add(BattleHero.PBBattleHeroToBattleHero(pbBattleHero2)); } foreach (ProTrainingTech tech in pbBusinessCard.Techs) { businessCard.Techs.Add(TrainingTech.FromDataSection(tech)); } return(businessCard); }
// Token: 0x06003D34 RID: 15668 RVA: 0x00114638 File Offset: 0x00112838 public void ReloadConfigData() { List <int> list = new List <int>(); for (int i = this.Techs.Count - 1; i >= 0; i--) { if (this.ConfigDataLoader.GetConfigDataTrainingCourseInfo(this.Techs[i].ConfigId) == null) { list.Add(i); } } foreach (int index in list) { this.Techs.RemoveAt(index); } using (List <int> .Enumerator enumerator2 = this.Config.Techs.GetEnumerator()) { while (enumerator2.MoveNext()) { int TechId = enumerator2.Current; if (this.ConfigDataLoader.GetConfigDataTrainingTechInfo(TechId) != null) { TrainingTech trainingTech = this.Techs.Find((TrainingTech t) => t.ConfigId == TechId); if (trainingTech != null) { trainingTech.ConfigDataLoader = this.ConfigDataLoader; } } } } }
// Token: 0x06003B04 RID: 15108 RVA: 0x0010D5C8 File Offset: 0x0010B7C8 public static BattleRoomPlayer PbBattleRoomPlayerToBattleRoomPlayer(ProBattleRoomPlayer pbPlayer) { BattleRoomPlayer battleRoomPlayer = new BattleRoomPlayer { UserId = pbPlayer.UserId, SessionId = pbPlayer.SessionId, ChannelId = pbPlayer.ChannelId, Name = pbPlayer.Name, HeadIcon = pbPlayer.HeadIcon, Level = pbPlayer.Level, PlayerBattleStatus = (PlayerBattleStatus)pbPlayer.PlayerBattleStatus, IsOffline = pbPlayer.Offline }; foreach (ProTrainingTech tech in pbPlayer.Techs) { battleRoomPlayer.Techs.Add(TrainingTech.FromDataSection(tech)); } if (pbPlayer.RealTimePVPInfo != null) { battleRoomPlayer.RTPVPInfo = new RealTimePVPInfo { Dan = pbPlayer.RealTimePVPInfo.Dan, LocalRank = pbPlayer.RealTimePVPInfo.LocalRank, GlobalRank = pbPlayer.RealTimePVPInfo.GlobalRank, Score = pbPlayer.RealTimePVPInfo.Score, UserId = pbPlayer.UserId, IsBot = false }; } return(battleRoomPlayer); }
// Token: 0x06004978 RID: 18808 RVA: 0x0016E734 File Offset: 0x0016C934 public bool CanLevelup(int TechId, int DeltaLevel = 1) { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_CanLevelupInt32Int32_hotfix != null) { return(Convert.ToBoolean(this.m_CanLevelupInt32Int32_hotfix.call(new object[] { this, TechId, DeltaLevel }))); } BJLuaObjHelper.IsSkipLuaHotfix = false; ConfigDataTrainingTechInfo configDataTrainingTechInfo = this.m_configDataLoader.GetConfigDataTrainingTechInfo(TechId); int techMaxLevel = this.GetTechMaxLevel(TechId); TrainingTech tech = this.GetTech(TechId); int level = tech.Level; bool result = true; for (int i = 1; i <= DeltaLevel; i++) { if (tech.Level >= techMaxLevel || this.IsTechLocked(TechId)) { result = false; break; } tech.Level++; } tech.Level = level; return(result); }
// Token: 0x06004D7B RID: 19835 RVA: 0x0017ACF0 File Offset: 0x00178EF0 public void UpdateTechLevel(int TechId, int Level) { TrainingTech tech = this.GetTech(TechId); tech.Level = Level; base.SetDirty(true); }
// Token: 0x06003D48 RID: 15688 RVA: 0x00114A08 File Offset: 0x00112C08 public static ProTrainingTech ToPro(this TrainingTech Tech) { return(new ProTrainingTech { ConfigId = Tech.ConfigId, Level = Tech.Level }); }
// Token: 0x0600498E RID: 18830 RVA: 0x0016F5F4 File Offset: 0x0016D7F4 private void __callDele_TrainingTechLevelupMissionEvent(TrainingTech obj) { Action <TrainingTech> trainingTechLevelupMissionEvent = this.TrainingTechLevelupMissionEvent; if (trainingTechLevelupMissionEvent != null) { trainingTechLevelupMissionEvent(obj); } }
// Token: 0x06003D03 RID: 15619 RVA: 0x00113CE0 File Offset: 0x00111EE0 public void AddNewLearntTech(TrainingTech Tech) { ConfigDataTrainingTechInfo configDataTrainingTechInfo = this.ConfigDataLoader.GetConfigDataTrainingTechInfo(Tech.ConfigId); ConfigDataTrainingCourseInfo CourseConfig = this.ConfigDataLoader.GetConfigDataTrainingCourseInfo(configDataTrainingTechInfo.m_courseId); ConfigDataTrainingRoomInfo RoomConfig = this.ConfigDataLoader.GetConfigDataTrainingRoomInfo(CourseConfig.RoomID); TrainingCourse trainingCourse = this.Rooms.Find((TrainingRoom r) => r.ConfigId == RoomConfig.ID).Courses.Find((TrainingCourse c) => c.ConfigId == CourseConfig.ID); trainingCourse.Techs.RemoveAll((TrainingTech t) => t.ConfigId == Tech.ConfigId); trainingCourse.Techs.Add(Tech); }
// Token: 0x06004D7A RID: 19834 RVA: 0x0017ACB4 File Offset: 0x00178EB4 public TrainingTech GetTech(int TechId) { TrainingTech trainingTech = this.TrainingGround.GetLearntTech(TechId); if (trainingTech == null) { trainingTech = this.TrainingGround.GetUnlearntTech(TechId); this.TrainingGround.AddNewLearntTech(trainingTech); } return(trainingTech); }
// Token: 0x06004E1D RID: 19997 RVA: 0x0017BE64 File Offset: 0x0017A064 public static ArenaBattleReport PBArenaBattleReportToArenaBattleReport(ProArenaBattleReport pbArenaBattleReport, bool isBattleData) { ArenaBattleReport arenaBattleReport = new ArenaBattleReport(); arenaBattleReport.InstanceId = pbArenaBattleReport.InstanceId; arenaBattleReport.Version = pbArenaBattleReport.Version; if (isBattleData) { arenaBattleReport.BattleType = (BattleType)pbArenaBattleReport.BattleType; arenaBattleReport.BattleId = pbArenaBattleReport.BattleId; arenaBattleReport.RandomSeed = pbArenaBattleReport.RandomSeed; arenaBattleReport.ArenaDefenderRuleId = pbArenaBattleReport.ArenaDefenderRuleId; foreach (ProBattleCommand pbBattleCommand in pbArenaBattleReport.Commands) { arenaBattleReport.Commands.Add(BattleCommand.PBBattleCommandToBattleCommand(pbBattleCommand)); } foreach (ProBattleHero pbBattleHero in pbArenaBattleReport.AttackerHeroes) { arenaBattleReport.AttackerHeroes.Add(BattleHero.PBBattleHeroToBattleHero(pbBattleHero)); } foreach (ProBattleHero pbBattleHero2 in pbArenaBattleReport.DefenderHeroes) { arenaBattleReport.DefenderHeroes.Add(BattleHero.PBBattleHeroToBattleHero(pbBattleHero2)); } foreach (ProTrainingTech tech in pbArenaBattleReport.AttackerTechs) { arenaBattleReport.AttackerTechs.Add(TrainingTech.FromDataSection(tech)); } foreach (ProTrainingTech tech2 in pbArenaBattleReport.DefenderTechs) { arenaBattleReport.DefenderTechs.Add(TrainingTech.FromDataSection(tech2)); } } else { arenaBattleReport.Status = (ArenaBattleReportStatus)pbArenaBattleReport.Status; arenaBattleReport.AttackerUserId = pbArenaBattleReport.AttackerUserId; arenaBattleReport.AttackerLevel = pbArenaBattleReport.AttackerLevel; arenaBattleReport.AttackerName = pbArenaBattleReport.AttackerName; arenaBattleReport.DefenderUserId = pbArenaBattleReport.DefenderUserId; arenaBattleReport.DefenderLevel = pbArenaBattleReport.DefenderLevel; arenaBattleReport.DefenderName = pbArenaBattleReport.DefenderName; arenaBattleReport.CreateTime = pbArenaBattleReport.CreateTime; arenaBattleReport.AttackerGotArenaPoints = pbArenaBattleReport.AttackerGotArenaPoints; arenaBattleReport.DefenderGotArenaPoints = pbArenaBattleReport.DefenderGotArenaPoints; arenaBattleReport.OpponentHeadIcon = pbArenaBattleReport.OpponentHeadIcon; } return(arenaBattleReport); }
// Token: 0x06003CFF RID: 15615 RVA: 0x00113B48 File Offset: 0x00111D48 public TrainingTech GetLearntTech(int TechId) { foreach (TrainingRoom trainingRoom in this.Rooms) { foreach (TrainingCourse trainingCourse in trainingRoom.Courses) { TrainingTech trainingTech = trainingCourse.Techs.Find((TrainingTech t) => t.ConfigId == TechId); if (trainingTech != null) { return(trainingTech); } } } return(null); }
// Token: 0x06004977 RID: 18807 RVA: 0x0016E56C File Offset: 0x0016C76C public bool IsTechLocked(int TechId) { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_IsTechLockedInt32_hotfix != null) { return(Convert.ToBoolean(this.m_IsTechLockedInt32_hotfix.call(new object[] { this, TechId }))); } BJLuaObjHelper.IsSkipLuaHotfix = false; ConfigDataTrainingTechInfo configDataTrainingTechInfo = this.m_configDataLoader.GetConfigDataTrainingTechInfo(TechId); int techMaxLevel = this.GetTechMaxLevel(TechId); TrainingTech tech = this.GetTech(TechId); if (tech.Level >= techMaxLevel) { return(false); } TrainingTechInfo TechInfo = configDataTrainingTechInfo.m_Infos[tech.Level]; ConfigDataTrainingCourseInfo configDataTrainingCourseInfo = this.m_configDataLoader.GetConfigDataTrainingCourseInfo(configDataTrainingTechInfo.m_courseId); TrainingRoom room = this.GetRoom(configDataTrainingCourseInfo.RoomID); if (room.Level < TechInfo.RoomLevel) { return(true); } if (TechInfo.PreIds == null || TechInfo.PreIds.Count == 0) { return(false); } List <TrainingTech> availableTechs = this.GetAvailableTechs(); int i; for (i = 0; i < TechInfo.PreIds.Count; i++) { int PreTechId = TechInfo.PreIds[i]; if (availableTechs.Find((TrainingTech t) => t.ConfigId == PreTechId && !this.IsTechLocked(t.ConfigId) && t.Level >= TechInfo.PreTechLevels[i]) == null) { return(true); } } return(false); }
// Token: 0x0600497D RID: 18813 RVA: 0x0016EBAC File Offset: 0x0016CDAC public void AddTechLevel(int TechId, int DeltaLevel, bool NoCheckAndCost = false) { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_AddTechLevelInt32Int32Boolean_hotfix != null) { this.m_AddTechLevelInt32Int32Boolean_hotfix.call(new object[] { this, TechId, DeltaLevel, NoCheckAndCost }); return; } BJLuaObjHelper.IsSkipLuaHotfix = false; TrainingTech tech = this.m_trainingGroundDS.GetTech(TechId); int num = tech.Level + DeltaLevel; ConfigDataTrainingTechInfo configDataTrainingTechInfo = this.m_configDataLoader.GetConfigDataTrainingTechInfo(TechId); if (!NoCheckAndCost) { TrainingTechResourceRequirements techLevelupResourceRequirements = this.GetTechLevelupResourceRequirements(TechId, DeltaLevel); List <Goods> list = new List <Goods>(); list.Add(new Goods { GoodsType = GoodsType.GoodsType_Gold, Count = techLevelupResourceRequirements.Gold }); list.AddRange(techLevelupResourceRequirements.Materials); this.m_bag.ConsumeGoods(list, null, null, GameFunctionType.GameFunctionType_TrainingGround, string.Format("{0}: {1}", TechId, num)); this.OutPutTeachnologyTreeOperateLog(configDataTrainingTechInfo.m_courseId, TechId, num, null, list); } this.m_trainingGroundDS.UpdateTechLevel(TechId, num); foreach (Hero hero in this.m_hero.GetAllHeros()) { this.ApplyTrainingTechToHero(hero, tech); this.m_hero.OnHeroBattlePowerChange(hero); } if (this.TrainingTechLevelupMissionEvent != null) { this.TrainingTechLevelupMissionEvent(tech); } }
// Token: 0x06004DE0 RID: 19936 RVA: 0x0017B6C4 File Offset: 0x001798C4 public static ArenaOpponentDefensiveBattleInfo PBDefensiveBattleInfoToDefensiveBattleInfo(ProArenaDefensiveBattleInfo pbDefensiveBattleInfo) { ArenaOpponentDefensiveBattleInfo arenaOpponentDefensiveBattleInfo = new ArenaOpponentDefensiveBattleInfo(); arenaOpponentDefensiveBattleInfo.BattleExpiredTime = pbDefensiveBattleInfo.BattleExpiredTime; arenaOpponentDefensiveBattleInfo.BattleRandomSeed = pbDefensiveBattleInfo.RandomSeed; arenaOpponentDefensiveBattleInfo.BattleTeamSnapshot.BattleId = pbDefensiveBattleInfo.BattleId; arenaOpponentDefensiveBattleInfo.BattleTeamSnapshot.ArenaDefenderRuleId = pbDefensiveBattleInfo.ArenaDefenderRuleId; arenaOpponentDefensiveBattleInfo.ArenaOpponentPointZoneId = pbDefensiveBattleInfo.ArenaOpponentPointZoneId; arenaOpponentDefensiveBattleInfo.BattleTeamSnapshot.PlayerLevel = pbDefensiveBattleInfo.PlayerLevel; foreach (ProBattleHero pbBattleHero in pbDefensiveBattleInfo.DefenderHeroes) { arenaOpponentDefensiveBattleInfo.BattleTeamSnapshot.DefenderHeroes.Add(BattleHero.PBBattleHeroToBattleHero(pbBattleHero)); } foreach (ProTrainingTech tech in pbDefensiveBattleInfo.Techs) { arenaOpponentDefensiveBattleInfo.BattleTeamSnapshot.Techs.Add(TrainingTech.FromDataSection(tech)); } return(arenaOpponentDefensiveBattleInfo); }
// Token: 0x0600510B RID: 20747 RVA: 0x00182480 File Offset: 0x00180680 public static RealTimePVPBattleReportPlayerData ToMemory(this ProRealTimePVPBattleReportPlayerData Data) { RealTimePVPBattleReportPlayerData realTimePVPBattleReportPlayerData = new RealTimePVPBattleReportPlayerData { HeadIcon = Data.HeadIcon, Level = Data.Level, Name = Data.Name, UserId = Data.UserId, ScoreDiff = Data.ScoreDiff }; foreach (ProBattleHero pbBattleHero in Data.Heroes) { realTimePVPBattleReportPlayerData.Heroes.Add(BattleHero.PBBattleHeroToBattleHero(pbBattleHero)); } foreach (ProTrainingTech tech in Data.Techs) { realTimePVPBattleReportPlayerData.Techs.Add(TrainingTech.FromDataSection(tech)); } return(realTimePVPBattleReportPlayerData); }
// Token: 0x06003D35 RID: 15669 RVA: 0x00114788 File Offset: 0x00112988 public void UpdateInstantiatedData(List <TrainingTech> AvailableTechs) { using (List <TrainingTech> .Enumerator enumerator = AvailableTechs.GetEnumerator()) { while (enumerator.MoveNext()) { TrainingTech AT = enumerator.Current; if (this.Config.Techs.FindIndex((int t) => t == AT.ConfigId) >= 0 && this.Techs.Find((TrainingTech t) => t.ConfigId == AT.ConfigId) == null) { this.WhichRoom.WhichTrainingGround.AddNewLearntTech(new TrainingTech { ConfigId = AT.ConfigId, Level = AT.Level, ConfigDataLoader = this.ConfigDataLoader }); } } } foreach (TrainingTech trainingTech in this.Techs) { trainingTech.UpdateInstantiatedData(AvailableTechs); } }
// Token: 0x06004D78 RID: 19832 RVA: 0x0017AB58 File Offset: 0x00178D58 public void UpdateInstantiatedData(DSTrainingGroundNtf DS) { List <TrainingTech> list = new List <TrainingTech>(); foreach (ProTrainingTech tech in DS.AvailableTechs) { list.Add(TrainingTech.FromDataSection(tech)); } IEnumerable <KeyValuePair <int, ConfigDataTrainingCourseInfo> > allConfigDataTrainingCourseInfo = this.TrainingGround.ConfigDataLoader.GetAllConfigDataTrainingCourseInfo(); foreach (KeyValuePair <int, ConfigDataTrainingCourseInfo> keyValuePair in allConfigDataTrainingCourseInfo) { foreach (int configId in keyValuePair.Value.Techs) { this.TrainingGround.AddNewLearntTech(new TrainingTech { ConfigDataLoader = this.TrainingGround.ConfigDataLoader, ConfigId = configId, Level = 0 }); } } this.TrainingGround.UpdateInstantiatedData(list); }
// Token: 0x0600497B RID: 18811 RVA: 0x0016E9F8 File Offset: 0x0016CBF8 public int CheckTechLevelup(int TechId, int DeltaLevel = 1) { if (!BJLuaObjHelper.IsSkipLuaHotfix && this.TryInitHotFix("") && this.m_CheckTechLevelupInt32Int32_hotfix != null) { return(Convert.ToInt32(this.m_CheckTechLevelupInt32Int32_hotfix.call(new object[] { this, TechId, DeltaLevel }))); } BJLuaObjHelper.IsSkipLuaHotfix = false; TrainingTech tech = this.m_trainingGroundDS.GetTech(TechId); if (!this.CanLevelup(TechId, DeltaLevel)) { return(-10077); } TrainingTechResourceRequirements techLevelupResourceRequirements = this.GetTechLevelupResourceRequirements(TechId, DeltaLevel); if (techLevelupResourceRequirements == null) { return(-10076); } if (!this.m_basicInfo.IsGoldEnough(techLevelupResourceRequirements.Gold)) { return(-400); } List <BagItemBase> list = this.m_bag.FindEnoughBagItems(techLevelupResourceRequirements.Materials); if (list.Count != techLevelupResourceRequirements.Materials.Count) { return(-10076); } return(0); }
// Token: 0x0600498F RID: 18831 RVA: 0x0016F618 File Offset: 0x0016D818 private void __clearDele_TrainingTechLevelupMissionEvent(TrainingTech obj) { this.TrainingTechLevelupMissionEvent = null; }
// Token: 0x06003D4A RID: 15690 RVA: 0x00114A58 File Offset: 0x00112C58 public static int GetTechLevel(this TrainingGround TG, int TechId) { TrainingTech learntTech = TG.GetLearntTech(TechId); return((learntTech != null) ? 0 : learntTech.Level); }