public void InitLevelData(int level, bool isElite) { base.level = level; NPCLevelMetaData nPCLevelMetaDataByKey = NPCLevelMetaDataReader.GetNPCLevelMetaDataByKey(level); base.baseMaxHP = base.maxHP = base.HP = this.metaConfig.HP * nPCLevelMetaDataByKey.HPRatio; base.defense = this.metaConfig.defense * nPCLevelMetaDataByKey.DEFRatio; base.attack = this.metaConfig.attack * nPCLevelMetaDataByKey.ATKRatio; base.PushProperty("Actor_ResistAllElementAttackRatio", nPCLevelMetaDataByKey.ElementalResistRatio); this.isElite = isElite; if (isElite) { base.baseMaxHP = base.maxHP = base.HP = base.maxHP * this.config.EliteArguments.HPRatio; base.defense *= this.config.EliteArguments.DefenseRatio; base.attack *= this.config.EliteArguments.AttackRatio; } foreach (KeyValuePair <string, ConfigEntityAbilityEntry> pair in this.config.Abilities) { base.abilityIDMap.Add(pair.Key, pair.Value.AbilityName); if (pair.Value.AbilityName != "Noop") { base.appliedAbilities.Add(Tuple.Create <ConfigAbility, Dictionary <string, object> >(AbilityData.GetAbilityConfig(pair.Value.AbilityName, pair.Value.AbilityOverride), AbilityData.EMPTY_OVERRIDE_MAP)); } } this.InitUniqueMonsterConfig(nPCLevelMetaDataByKey); }
private void InitUniqueMonsterConfig(NPCLevelMetaData npcLevelMetaData) { if (this.uniqueMonsterID != 0) { UniqueMonsterMetaData uniqueMonsterMetaData = MonsterData.GetUniqueMonsterMetaData(this.uniqueMonsterID); base.baseMaxHP = base.maxHP = base.HP = (this.metaConfig.HP * uniqueMonsterMetaData.HPRatio) * npcLevelMetaData.HPRatio; base.defense = (this.metaConfig.defense * uniqueMonsterMetaData.defenseRatio) * npcLevelMetaData.DEFRatio; base.attack = (this.metaConfig.attack * uniqueMonsterMetaData.attackRatio) * npcLevelMetaData.ATKRatio; if (uniqueMonsterMetaData.abilities.Length > 0) { LuaState state = new LuaState(); IDictionaryEnumerator enumerator = ((LuaTable)state.DoString(uniqueMonsterMetaData.abilities)[0]).GetEnumerator(); try { while (enumerator.MoveNext()) { ConfigAbility abilityConfig; DictionaryEntry current = (DictionaryEntry)enumerator.Current; string key = (string)current.Key; LuaTable table2 = (LuaTable)current.Value; string monsterName = uniqueMonsterMetaData.monsterName; if (monsterName == null) { abilityConfig = AbilityData.GetAbilityConfig(key); } else { abilityConfig = AbilityData.GetAbilityConfig(key, monsterName); } Dictionary <string, object> dictionary = new Dictionary <string, object>(); IDictionaryEnumerator enumerator2 = table2.GetEnumerator(); try { while (enumerator2.MoveNext()) { DictionaryEntry entry2 = (DictionaryEntry)enumerator2.Current; string str3 = (string)entry2.Key; if (entry2.Value is double) { dictionary.Add(str3, (float)((double)entry2.Value)); } else if (entry2.Value is string) { dictionary.Add(str3, (string)entry2.Value); } } } finally { IDisposable disposable = enumerator2 as IDisposable; if (disposable == null) { } disposable.Dispose(); } base.appliedAbilities.Add(Tuple.Create <ConfigAbility, Dictionary <string, object> >(abilityConfig, dictionary)); } } finally { IDisposable disposable2 = enumerator as IDisposable; if (disposable2 == null) { } disposable2.Dispose(); } } } }